Changeset 29440
- Timestamp:
- Oct 15, 2010, 6:39:07 PM (16 years ago)
- Location:
- branches/haf_branches/ipp.rsync.20101015
- Files:
-
- 4 added
- 6 edited
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/minidvodb.md (modified) (1 diff)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/minidvodbtool_find_minidvodb_id_dvo.sql (added)
-
ippTools/share/minidvodbtool_revertminidvodbcopy.sql (added)
-
ippTools/src/Makefile.am (modified) (2 diffs)
-
ippTools/src/minidvodbtool.c (modified) (13 diffs)
-
ippTools/src/minidvodbtoolConfig.c (modified) (4 diffs)
-
ippTools/src/pxminidvodb.c (added)
-
ippTools/src/pxminidvodb.h (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/haf_branches/ipp.rsync.20101015/dbconfig/changes.txt
r28873 r29440 1945 1945 ALTER TABLE diffSummary DROP PRIMARY KEY, ADD PRIMARY KEY (diff_id, projection_cell); 1946 1946 ALTER TABLE stackSummary DROP PRIMARY KEY, ADD PRIMARY KEY (sass_id, projection_cell); 1947 1948 1949 -- minidvodb copy table (for tracking copying of minidvodbs to other machines 1950 1951 1952 CREATE TABLE minidvodbCopy ( 1953 minidvodbcopy_id BIGINT AUTO_INCREMENT, 1954 minidvodb_id BIGINT, 1955 minidvodb_rsync_path VARCHAR(255) NOT NULL, 1956 destination_host VARCHAR(255) NOT NULL, 1957 fault SMALLINT NOT NULL, 1958 state VARCHAR(64) NOT NULL, 1959 epoch TIMESTAMP, 1960 dtime FLOAT, 1961 PRIMARY KEY(minidvodbcopy_id), 1962 KEY(minidvodb_id), 1963 FOREIGN KEY(minidvodb_id) REFERENCES minidvodbRun(minidvodb_id) 1964 ) ENGINE=innodb DEFAULT CHARSET=latin1; -
branches/haf_branches/ipp.rsync.20101015/dbconfig/minidvodb.md
r29435 r29440 21 21 22 22 minidvodbCopy METADATA 23 minidvodbcopy_id S64 0 23 24 minidvodb_id S64 0 24 25 minidvodb_rsync_path STR 255 26 destination_host STR 255 25 27 fault S16 0 26 28 state STR 64 -
branches/haf_branches/ipp.rsync.20101015/ippTools/share/Makefile.am
r29415 r29440 264 264 magicdstool_torevert_warp.sql \ 265 265 magicdstool_torevert_diff.sql \ 266 minidvodbtool_find_minidvodb_id_dvo.sql \ 267 minidvodbtool_revertminidvodbcopy.sql \ 266 268 pstamptool_completedreq.sql \ 267 269 pstamptool_datastore.sql \ -
branches/haf_branches/ipp.rsync.20101015/ippTools/src/Makefile.am
r29435 r29440 40 40 pxdqstats.h 41 41 pxmagic.h \ 42 pxminidvodb.h \ 42 43 pxregister.h \ 43 44 pxspace.h \ … … 92 93 pxdqstats.c \ 93 94 pxmagic.c \ 95 pxminidvodb.c \ 94 96 pxregister.c \ 95 97 pxspace.c \ -
branches/haf_branches/ipp.rsync.20101015/ippTools/src/minidvodbtool.c
r29435 r29440 28 28 #include "pxtools.h" 29 29 #include "pxadd.h" 30 #include "pxminidvodb.h" 30 31 #include "minidvodbtool.h" 31 32 … … 90 91 psMetadata *where = psMetadataAlloc(); 91 92 pxcamGetSearchArgs (config, where); 92 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 93 pxAddLabelSearchArgs (config, where, "-label", "camRun.label", "=="); // define using camRun label 94 pxAddLabelSearchArgs (config, where, "-data_group","camRun.data_group", "=="); // define using camRun label 95 PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "=="); 93 PXOPT_COPY_S64(config->args, where, "-minidvodb_id", "minidvodbRun.minidvodbRun_id", "=="); 94 pxAddLabelSearchArgs (config, where, "-minidvodb_group", "minidvodbRun.minidvodb_group", "=="); // define using camRun label 95 96 96 97 97 … … 102 102 } 103 103 104 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false); 105 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false); 106 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 107 PXOPT_LOOKUP_STR(data_group, config->args, "-set_data_group", false, false); 108 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); 109 PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false); 110 PXOPT_LOOKUP_STR(minidvodb_name, config->args, "-set_minidvodb_name", false, false); 111 PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", false, false); 112 PXOPT_LOOKUP_BOOL(image_only, config->args, "-image_only", false); 113 PXOPT_LOOKUP_BOOL(minidvodb, config->args, "-set_minidvodb", false); 114 PXOPT_LOOKUP_BOOL(destreaked, config->args, "-destreaked", false); 104 PXOPT_LOOKUP_STR(destination_host, config->args, "-set_destination_host", false, false); 105 PXOPT_LOOKUP_STR(minidvodb_rsync_path, config->args, "-set_minidvodb_rsync_path", false, false); 115 106 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 116 107 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); … … 120 111 psString dvodb_string = NULL; 121 112 psString bare_query = NULL; 122 if (d vodb) {123 psTrace(" addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_cam_id_dvo.sql\n", dvodb);113 if (destination_host) { 114 psTrace("minidvodbtool.c", PS_LOG_INFO, "destination_host argument found (%s) using minidvodbtool_find_minidvodb_id_dvo.sql\n", destination_host); 124 115 // find the cam_id of all the exposures that we want to queue up. 125 bare_query = pxDataGet(" addtool_find_cam_id_dvo.sql");116 bare_query = pxDataGet("minidvodbtool_find_minidvodb_id_dvo.sql"); 126 117 // user supplied dvodb 127 psStringAppend(&dvodb_string, " addRun.dvodb = '%s'", dvodb);118 psStringAppend(&dvodb_string, "minidvodbCopy.destination_host = '%s'", destination_host); 128 119 } else { 129 psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_cam_id.sql\n"); 130 // find the cam_id of all the exposures that we want to queue up. 131 bare_query = pxDataGet("addtool_find_cam_id.sql"); 132 // inherit dvodb from camRun, avoid matching NULL 133 psStringAppend(&dvodb_string, "(camRun.dvodb IS NOT NULL AND previous_dvodb = camRun.dvodb)"); 134 } 120 psError(PS_ERR_UNKNOWN, false, "cannot queue minidvodbcopy run without a defined destination_host"); 121 122 return false; 123 } 135 124 if (!bare_query) { 136 125 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); … … 155 144 psFree(where); 156 145 157 if (destreaked) { 158 psStringAppend(&query, " AND (camRun.magicked > 0)"); 159 } 160 161 if (!p_psDBRunQuery(config->dbh, query)) { 146 if (!p_psDBRunQuery(config->dbh, query)) { 162 147 psError(PS_ERR_UNKNOWN, false, "database error"); 163 148 psFree(query); … … 179 164 if (pretend) { 180 165 // negative simple so the default is true 181 if (!ippdbPrintMetadatas(stdout, output, " addRun", !simple)) {166 if (!ippdbPrintMetadatas(stdout, output, "minidvodbCopy", !simple)) { 182 167 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 183 168 psFree(output); … … 192 177 psMetadata *md = output->data[i]; 193 178 194 camRunRow *row = camRunObjectFromMetadata(md);179 minidvodbRunRow *row = minidvodbRunObjectFromMetadata(md); 195 180 if (!row) { 196 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");181 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into minidvodbRun"); 197 182 psFree(output); 198 183 return false; 199 184 } 200 185 201 if (! dvodb && !row->dvodb) {202 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, cam_id %" PRId64, row->label, row->cam_id);186 if (!minidvodb_rsync_path) { 187 psError(PS_ERR_UNKNOWN, false, "cannot queue minidvodbcopy run without a defined minidvodb_rsync_path: minidvodb_id %" PRId64, row->minidvodb_id); 203 188 psFree(output); 204 189 return false; 205 190 } 206 if (! workdir && !row->workdir) {207 psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, cam_id %" PRId64, row->label, row->cam_id);191 if (!destination_host) { 192 psError(PS_ERR_UNKNOWN, false, "cannot queue minidvodbcopy run without a defined destination_host: minidvodb_id %" PRId64, row->minidvodb_id); 208 193 psFree(output); 209 194 return false; … … 230 215 psMetadata *md = output->data[i]; 231 216 232 camRunRow *row = camRunObjectFromMetadata(md);217 minidvodbRunRow *row = minidvodbRunObjectFromMetadata(md); 233 218 if (!row) { 234 219 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); … … 238 223 239 224 // queue the exp 240 if (!pxaddQueueByCamID(config, 241 row->cam_id, 242 workdir ? workdir : row->workdir, 243 reduction ? reduction : row->reduction, 244 label ? label : row->label, 245 data_group ? data_group : (row->data_group ? row->data_group : (label ? label : row->label)), 246 dvodb ? dvodb : row->dvodb, 247 note ? note : NULL, 248 image_only, 249 minidvodb, 250 minidvodb_group, 251 minidvodb_name 225 if (!pxaddQueueByMinidvodbID(config, 226 row->minidvodb_id, 227 destination_host ? destination_host : "NULL", 228 minidvodb_rsync_path ?minidvodb_rsync_path : "NULL" 252 229 )) { 253 230 if (!psDBRollback(config->dbh)) { … … 255 232 } 256 233 psError(PS_ERR_UNKNOWN, false, 257 "failed to trying to queue chip_id: %" PRId64, row->cam_id);234 "failed to trying to queue minidvodb_id: %" PRId64, row->minidvodb_id); 258 235 psFree(row); 259 236 psFree(output); … … 553 530 psMetadata *where = psMetadataAlloc(); 554 531 PS_ASSERT_PTR_NON_NULL(config, false); 555 PXOPT_COPY_S64(config->args, where, "-minidvodb _id", "minidvodbCopy.minidvodb_id", "==");556 PXOPT_COPY_STR(config->args, where, "- minidvodb_group", "addRun.minidvodb_group", "==");532 PXOPT_COPY_S64(config->args, where, "-minidvodbcopy_id", "minidvodbCopy.minidvodbcopy_id", "=="); 533 PXOPT_COPY_STR(config->args, where, "-destination_host", "destination host", "=="); 557 534 558 535 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { … … 614 591 PS_ASSERT_PTR_NON_NULL(config, false); 615 592 psMetadata *where = psMetadataAlloc(); 616 617 PXOPT_LOOKUP_U64(minidvodb_id, config->args, "-minidvodb_id", true, false); 618 PXOPT_LOOKUP_U64(merge_order, config->args, "-set_merge_order", false, false); 619 PXOPT_LOOKUP_S16(fault, config->args, "-set_fault", false, false); 620 PXOPT_LOOKUP_F32(dtime_relphot, config->args, "-set_dtime_relphot", false, false); 621 PXOPT_LOOKUP_F32(dtime_resort, config->args, "-set_dtime_resort", false, false); 622 PXOPT_LOOKUP_F32(dtime_merge, config->args, "-set_dtime_merge", false, false); 623 593 PXOPT_LOOKUP_U64(minidvodbcopy_id, config->args, "-minidvodbcopy_id", false, false); 594 PXOPT_LOOKUP_U64(minidvodb_id, config->args, "-minidvodb_id", false, false); 595 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 596 PXOPT_LOOKUP_STR(host, config->args, "-host", false, false); 597 PXOPT_LOOKUP_STR(rsync_path, config->args, "-minidvodb_rsync_path", false, false); 598 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 599 600 PXOPT_LOOKUP_S16(set_fault, config->args, "-set_fault", false, false); 601 PXOPT_LOOKUP_STR(set_rsync_path, config->args, "-set_minidvodb_rsync_path", false, false); 602 PXOPT_LOOKUP_STR(set_host, config->args, "-set_destination_host", false, false); 603 PXOPT_LOOKUP_STR(set_state, config->args, "-set_state", false, false); 604 PXOPT_LOOKUP_F32(dtime, config->args, "-set_dtime", false, false); 605 PXOPT_COPY_S64(config->args, where, "-minidvodbcopy_id", "minidvodbCopy.minidvodbcopy_id", "=="); 624 606 PXOPT_COPY_S64(config->args, where, "-minidvodb_id", "minidvodbCopy.minidvodb_id", "=="); 625 PXOPT_COPY_STR(config->args, where, "-minidvodb_name", "minidvodbRun.minidvodb_name", "=="); 607 608 PXOPT_COPY_STR(config->args, where, "-state", "minidvodbCopy.state", "=="); 609 PXOPT_COPY_STR(config->args, where, "-host", "minidvodbCopy.destination_host", "=="); 610 PXOPT_COPY_STR(config->args, where, "-minidvodb_rsync_path", "minidvodbCopy.minidvodb_rsync_path", "=="); 626 611 627 612 … … 635 620 int cnt = 0; 636 621 psString comma = ","; 637 if ( fault) {638 psStringAppend(&query, " fault = %d", fault);622 if (set_fault) { 623 psStringAppend(&query, " fault = %d", set_fault); 639 624 cnt++; 640 625 } 641 626 642 if ( merge_order) {627 if (set_rsync_path) { 643 628 if (cnt) { 644 629 psStringAppend(&query, "%s", comma); 645 630 } 646 631 647 psStringAppend(&query, " m erge_order = %" PRId64, merge_order);632 psStringAppend(&query, " minidvodb_rsync_path = %s" , set_rsync_path); 648 633 cnt++; 649 634 } 650 635 651 if ( dtime_relphot) {636 if (set_host) { 652 637 if (cnt) { 653 638 psStringAppend(&query, "%s", comma); 654 639 } 655 psStringAppend(&query, " dtime_relphot = %f", dtime_relphot); 640 641 psStringAppend(&query, " destination_host = %s" , set_host); 656 642 cnt++; 657 643 } 658 644 659 if (dtime_resort) { 645 646 if (set_state) { 660 647 if (cnt) { 661 648 psStringAppend(&query, "%s", comma); 662 649 } 663 psStringAppend(&query, " dtime_resort = %f", dtime_resort); 650 651 psStringAppend(&query, " state = %s" , set_state); 664 652 cnt++; 665 653 } 666 654 667 if (dtime _merge) {655 if (dtime) { 668 656 if (cnt) { 669 657 psStringAppend(&query, "%s", comma); 670 658 } 671 psStringAppend(&query, " dtime _merge = %f", dtime_merge);659 psStringAppend(&query, " dtime = %f", dtime); 672 660 cnt++; 673 } 661 } 662 663 674 664 675 665 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); -
branches/haf_branches/ipp.rsync.20101015/ippTools/src/minidvodbtoolConfig.c
r29435 r29440 2 2 * addtoolConfig.c 3 3 * 4 * Copyright (C) 2009 Joshua Hoblitt, Chris Waters5 4 * 6 5 * This program is free software; you can redistribute it and/or modify it … … 29 28 #include "pxtools.h" 30 29 #include "pxadd.h" 30 #include "pxminidvodb.h" 31 31 #include "minidvodbtool.h" 32 32 … … 49 49 // -definebyquery 50 50 psMetadata *definebyqueryArgs = psMetadataAlloc(); 51 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "- cam_id", 0, "search by cam_id", 0);51 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-minidvodb_id", 0, "search by cam_id", 0); 52 52 pxcamSetSearchArgs(definebyqueryArgs); 53 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by camRun label", NULL); 54 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by camRun data_group", NULL); 55 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction", 0, "search by camRun reduction class", NULL); 56 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-destreaked", 0, "only queue destreaked runs", false); 53 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-minidvodb_group", PS_META_DUPLICATE_OK, "search by camRun data_group", NULL); 57 54 58 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_workdir", 0, "define workdir", NULL); 59 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_label", 0, "define label", NULL); 55 56 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_rsync_path", 0, "define workdir", NULL); 57 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_destination_host", 0, "define label", NULL); 60 58 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_reduction", 0, "define reduction class", NULL); 61 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_dvodb", 0, "define DVO db", NULL); 62 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-image_only", 0, "addstar image metadata but not detections", false); 63 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false); 59 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false); 64 60 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 65 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb", 0, "use minidvodb", false); 66 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_group", 0, "define minidvodb_group", NULL); 67 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_name", 0, "define minidvodb_bname", NULL); 68 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_data_group", 0, "define new data_group", NULL); 69 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_dist_group", 0, "define new dist_group", NULL); 70 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_note", 0, "define new note", NULL); 71 61 72 62 psMetadata *addminidvodbcopyArgs = psMetadataAlloc(); 73 63 psMetadataAddU64(addminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodb_id", 0, "define minidvodb_id (required)", 0); … … 90 80 91 81 psMetadata *revertminidvodbcopyArgs = psMetadataAlloc(); 92 psMetadataAddU64(revertminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodb _id", 0, "search by minidvodb_id", 0);93 psMetadataAddStr(revertminidvodbcopyArgs, PS_LIST_TAIL, "- minidvodb_group", 0, "search by addRun.minidvodb_group", NULL);82 psMetadataAddU64(revertminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodbcopy_id", 0, "search by minidvodbcopy_id", 0); 83 psMetadataAddStr(revertminidvodbcopyArgs, PS_LIST_TAIL, "-destination host", 0, "search by destination_host", NULL); 94 84 95 85 psMetadata *updateminidvodbcopyArgs = psMetadataAlloc(); 86 psMetadataAddU64(updateminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodbcopy_id", 0, "search by minidvodbcopy_id", 0); 96 87 psMetadataAddU64(updateminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodb_id", 0, "search by minidvodb_id", 0); 97 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodb_name", 0, "search by minidvodb_name", NULL); 88 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 89 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-host", 0, "search by host", NULL); 90 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-minidvodb_rsync_path", 0, "search by rsync", NULL); 91 psMetadataAddS16(updateminidvodbcopyArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0); 92 93 98 94 psMetadataAddS16(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_fault", 0, "set fault code", 0); 99 psMetadataAddU64(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_merge_order", 0, "define merge order", 0); 100 psMetadataAddF32(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_dtime_relphot", 0, "define elapsed time for relphot (seconds)", 0); 101 psMetadataAddF32(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_dtime_resort", 0, "define elapsed time for resort (seconds)", 0); 102 psMetadataAddF32(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_dtime_merge", 0, "define elapsed time for DVO merge (seconds)", 0); 103 95 96 psMetadataAddF32(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_dtime", 0, "set elapsed time for transfer", 0); 97 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_minidvodb_rsync_path", 0, "change the minidvodb_rsync_path", NULL); 98 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_destination_host", 0, "change the host", NULL); 99 psMetadataAddStr(updateminidvodbcopyArgs, PS_LIST_TAIL, "-set_state", 0, "change the state", NULL); 100 104 101 psMetadata *argSets = psMetadataAlloc(); 105 102 psMetadata *modes = psMetadataAlloc();
Note:
See TracChangeset
for help on using the changeset viewer.
