Changeset 25509
- Timestamp:
- Sep 23, 2009, 1:41:56 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
ippTasks/diff.pro (modified) (4 diffs)
-
ippTools/src/difftool.c (modified) (6 diffs)
-
ippTools/src/difftool.h (modified) (1 diff)
-
ippTools/src/difftoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTasks/diff.pro
r24595 r25509 14 14 ### Database lists 15 15 $diffSkycell_DB = 0 16 $diffAdvance_DB = 0 16 17 #$diffCleanup_DB = 0 17 18 … … 36 37 active true 37 38 end 39 task diff.advance 40 active true 41 end 38 42 end 39 43 … … 44 48 end 45 49 task diff.skycell.run 50 active false 51 end 52 task diff.advance 46 53 active false 47 54 end … … 198 205 end 199 206 end 207 208 209 # Advance exposures which have completed 210 task diff.advance 211 host local 212 213 periods -poll $LOADPOLL 214 # periods -exec $LOADEXEC 215 periods -exec 30 216 periods -timeout 60 217 npending 1 218 219 stdout NULL 220 stderr $LOGDIR/diff.advance.log 221 222 task.exec 223 if ($LABEL:n == 0) break 224 $run = difftool -advance -limit 10 225 if ($DB:n == 0) 226 option DEFAULT 227 else 228 # save the DB name for the exit tasks 229 option $DB:$diffAdvance_DB 230 $run = $run -dbname $DB:$diffAdvance_DB 231 $diffAdvance_DB ++ 232 if ($diffAdvance_DB >= $DB:n) set diffAdvance_DB = 0 233 end 234 add_poll_args run 235 add_poll_labels run 236 command $run 237 end 238 239 # success 240 task.exit 0 241 end 242 243 # locked list 244 task.exit default 245 showcommand failure 246 end 247 248 task.exit crash 249 showcommand crash 250 end 251 252 # operation times out? 253 task.exit timeout 254 showcommand timeout 255 end 256 end 257 258 200 259 201 260 # # select images ready for diff analysis -
trunk/ippTools/src/difftool.c
r25074 r25509 37 37 static bool todiffskyfileMode(pxConfig *config); 38 38 static bool adddiffskyfileMode(pxConfig *config); 39 static bool advanceMode(pxConfig *config); 39 40 static bool diffskyfileMode(pxConfig *config); 40 41 static bool revertdiffskyfileMode(pxConfig *config); … … 50 51 51 52 static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state, psS64 magicked); 52 static bool diffRunComplete(pxConfig *config);53 53 54 54 # define MODECASE(caseName, func) \ … … 76 76 MODECASE(DIFFTOOL_MODE_TODIFFSKYFILE, todiffskyfileMode); 77 77 MODECASE(DIFFTOOL_MODE_ADDDIFFSKYFILE, adddiffskyfileMode); 78 MODECASE(DIFFTOOL_MODE_ADVANCE, advanceMode); 78 79 MODECASE(DIFFTOOL_MODE_DIFFSKYFILE, diffskyfileMode); 79 80 MODECASE(DIFFTOOL_MODE_REVERTDIFFSKYFILE, revertdiffskyfileMode); 80 81 MODECASE(DIFFTOOL_MODE_DEFINEPOPRUN, definepoprunMode); 81 MODECASE(DIFFTOOL_MODE_DEFINEWARPSTACK, definewarpstackMode);82 MODECASE(DIFFTOOL_MODE_DEFINEWARPSTACK, definewarpstackMode); 82 83 MODECASE(DIFFTOOL_MODE_DEFINEWARPWARP, definewarpwarpMode); 83 84 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); … … 555 556 } 556 557 557 if (!diffRunComplete(config)) {558 if (!psDBRollback(config->dbh)) {559 psError(PS_ERR_UNKNOWN, false, "database error");560 }561 psError(PS_ERR_UNKNOWN, false, "database error");562 return false;563 }564 565 558 // point of no return 566 559 if (!psDBCommit(config->dbh)) { … … 569 562 } 570 563 564 565 return true; 566 } 567 568 static bool advanceMode(pxConfig *config) 569 { 570 PS_ASSERT_PTR_NON_NULL(config, false); 571 572 psMetadata *where = psMetadataAlloc(); 573 PXOPT_COPY_S64(config->args, where, "-diff_id", "diffRun.diff_id", "=="); 574 PXOPT_COPY_STR(config->args, where, "-label", "diffRun.label", "=="); 575 576 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 577 578 // look for completed diffRuns 579 psString query = pxDataGet("difftool_completed_runs.sql"); 580 if (!query) { 581 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 582 return false; 583 } 584 585 if (psListLength(where->list)) { 586 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 587 psStringAppend(&query, " WHERE %s", whereClause); 588 psFree(whereClause); 589 } 590 psFree(where); 591 592 // treat limit == 0 as "no limit" 593 if (limit) { 594 psString limitString = psDBGenerateLimitSQL(limit); 595 psStringAppend(&query, " %s", limitString); 596 psFree(limitString); 597 } 598 599 if (!psDBTransaction(config->dbh)) { 600 psError(PS_ERR_UNKNOWN, false, "database error"); 601 return false; 602 } 603 604 if (!p_psDBRunQuery(config->dbh, query)) { 605 psError(PS_ERR_UNKNOWN, false, "database error"); 606 psFree(query); 607 if (!psDBRollback(config->dbh)) { 608 psError(PS_ERR_UNKNOWN, false, "database error"); 609 } 610 return false; 611 } 612 psFree(query); 613 614 psArray *output = p_psDBFetchResult(config->dbh); 615 if (!output) { 616 psError(PS_ERR_UNKNOWN, false, "database error"); 617 if (!psDBRollback(config->dbh)) { 618 psError(PS_ERR_UNKNOWN, false, "database error"); 619 } 620 return false; 621 } 622 if (!psArrayLength(output)) { 623 psTrace("difftool", PS_LOG_INFO, "no rows found"); 624 psFree(output); 625 return true; 626 } 627 628 for (long i = 0; i < psArrayLength(output); i++) { 629 psMetadata *row = output->data[i]; 630 631 psS64 diff_id = psMetadataLookupS64(NULL, row, "diff_id"); 632 psS64 magicked = psMetadataLookupS64(NULL, row, "magicked"); 633 634 // set diffRun.state to 'full' 635 if (!setdiffRunState(config, diff_id, "full", magicked)) { 636 psError(PS_ERR_UNKNOWN, false, "failed to change diffRun.state for diff_id: %" PRId64, 637 diff_id); 638 psFree(output); 639 if (!psDBRollback(config->dbh)) { 640 psError(PS_ERR_UNKNOWN, false, "database error"); 641 } 642 return false; 643 } 644 } 645 psFree(output); 646 647 if (!psDBCommit(config->dbh)) { 648 psError(PS_ERR_UNKNOWN, false, "database error"); 649 return false; 650 } 571 651 572 652 return true; … … 1810 1890 } 1811 1891 1812 static bool diffRunComplete(pxConfig *config)1813 {1814 PS_ASSERT_PTR_NON_NULL(config, false);1815 1816 // look for completed diffRuns1817 psString query = pxDataGet("difftool_completed_runs.sql");1818 if (!query) {1819 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");1820 return false;1821 }1822 1823 if (!p_psDBRunQuery(config->dbh, query)) {1824 psError(PS_ERR_UNKNOWN, false, "database error");1825 psFree(query);1826 return false;1827 }1828 psFree(query);1829 1830 psArray *output = p_psDBFetchResult(config->dbh);1831 if (!output) {1832 psError(PS_ERR_UNKNOWN, false, "database error");1833 return false;1834 }1835 if (!psArrayLength(output)) {1836 psTrace("difftool", PS_LOG_INFO, "no rows found");1837 psFree(output);1838 return true;1839 }1840 for (long i = 0; i < psArrayLength(output); i++) {1841 psMetadata *row = output->data[i];1842 1843 psS64 diff_id = psMetadataLookupS64(NULL, row, "diff_id");1844 psS64 magicked = psMetadataLookupS64(NULL, row, "magicked");1845 1846 // set diffRun.state to 'stop'1847 if (!setdiffRunState(config, diff_id, "full", magicked)) {1848 psError(PS_ERR_UNKNOWN, false, "failed to change diffRun.state for diff_id: %" PRId64,1849 diff_id);1850 psFree(output);1851 return false;1852 }1853 }1854 1855 return true;1856 }1857 1892 1858 1893 bool exportrunMode(pxConfig *config) -
trunk/ippTools/src/difftool.h
r24174 r25509 31 31 DIFFTOOL_MODE_TODIFFSKYFILE, 32 32 DIFFTOOL_MODE_ADDDIFFSKYFILE, 33 DIFFTOOL_MODE_ADVANCE, 33 34 DIFFTOOL_MODE_DIFFSKYFILE, 34 35 DIFFTOOL_MODE_REVERTDIFFSKYFILE, -
trunk/ippTools/src/difftoolConfig.c
r24933 r25509 114 114 psMetadataAddF32(adddiffskyfileArgs, PS_LIST_TAIL, "-good_frac", 0, "define %% of good pixels", NAN); 115 115 psMetadataAddBool(adddiffskyfileArgs, PS_LIST_TAIL, "-magicked", 0, "define magicked state", false); 116 117 // -advance 118 psMetadata *advanceArgs = psMetadataAlloc(); 119 psMetadataAddS64(advanceArgs, PS_LIST_TAIL, "-diff_id", 0, "select by diff ID", 0); 120 psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-label", 0, "select by label", NULL); 116 121 117 122 // -diffskyfile … … 267 272 PXOPT_ADD_MODE("-todiffskyfile", "", DIFFTOOL_MODE_TODIFFSKYFILE, todiffskyfileArgs); 268 273 PXOPT_ADD_MODE("-adddiffskyfile", "", DIFFTOOL_MODE_ADDDIFFSKYFILE, adddiffskyfileArgs); 274 PXOPT_ADD_MODE("-advance", "", DIFFTOOL_MODE_ADVANCE, advanceArgs); 269 275 PXOPT_ADD_MODE("-diffskyfile", "", DIFFTOOL_MODE_DIFFSKYFILE, diffskyfileArgs); 270 276 PXOPT_ADD_MODE("-revertdiffskyfile","", DIFFTOOL_MODE_REVERTDIFFSKYFILE, revertdiffskyfileArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
