Changeset 30446
- Timestamp:
- Jan 31, 2011, 2:51:48 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205
- Files:
-
- 82 edited
- 37 copied
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (1 diff)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm (modified) (5 diffs)
-
catalyst/10.0-specs (copied) (copied from trunk/catalyst/10.0-specs )
-
catalyst/10.0-specs/.2.6.28-rc7-00105-gfeaf384.conf (copied) (copied from trunk/catalyst/10.0-specs/.2.6.28-rc7-00105-gfeaf384.conf )
-
catalyst/10.0-specs/.2.6.34.4-conf.NO_LSI_MEGA (copied) (copied from trunk/catalyst/10.0-specs/.2.6.34.4-conf.NO_LSI_MEGA )
-
catalyst/10.0-specs/.2.6.34.4-conf.SYSFS_DEPRECATED (copied) (copied from trunk/catalyst/10.0-specs/.2.6.34.4-conf.SYSFS_DEPRECATED )
-
catalyst/10.0-specs/2.6.34.4-conf (copied) (copied from trunk/catalyst/10.0-specs/2.6.34.4-conf )
-
catalyst/10.0-specs/hardened (copied) (copied from trunk/catalyst/10.0-specs/hardened )
-
catalyst/10.0-specs/hardened/stage1-nomultilib.spec (copied) (copied from trunk/catalyst/10.0-specs/hardened/stage1-nomultilib.spec )
-
catalyst/10.0-specs/hardened/stage1.spec (copied) (copied from trunk/catalyst/10.0-specs/hardened/stage1.spec )
-
catalyst/10.0-specs/hardened/stage2-nomultilib.spec (copied) (copied from trunk/catalyst/10.0-specs/hardened/stage2-nomultilib.spec )
-
catalyst/10.0-specs/hardened/stage2.spec (copied) (copied from trunk/catalyst/10.0-specs/hardened/stage2.spec )
-
catalyst/10.0-specs/hardened/stage3-nomultilib.spec (copied) (copied from trunk/catalyst/10.0-specs/hardened/stage3-nomultilib.spec )
-
catalyst/10.0-specs/hardened/stage3.spec (copied) (copied from trunk/catalyst/10.0-specs/hardened/stage3.spec )
-
catalyst/10.0-specs/installcd-stage1.spec (copied) (copied from trunk/catalyst/10.0-specs/installcd-stage1.spec )
-
catalyst/10.0-specs/installcd-stage2-minimal.spec (copied) (copied from trunk/catalyst/10.0-specs/installcd-stage2-minimal.spec )
-
catalyst/10.0-specs/livecd-stage1.spec (copied) (copied from trunk/catalyst/10.0-specs/livecd-stage1.spec )
-
catalyst/10.0-specs/livecd-stage2.spec (copied) (copied from trunk/catalyst/10.0-specs/livecd-stage2.spec )
-
catalyst/10.0-specs/livedvd-stage1.spec (copied) (copied from trunk/catalyst/10.0-specs/livedvd-stage1.spec )
-
catalyst/10.0-specs/livedvd-stage2.spec (copied) (copied from trunk/catalyst/10.0-specs/livedvd-stage2.spec )
-
catalyst/10.0-specs/stage1.spec (copied) (copied from trunk/catalyst/10.0-specs/stage1.spec )
-
catalyst/10.0-specs/stage2-desktop.spec (copied) (copied from trunk/catalyst/10.0-specs/stage2-desktop.spec )
-
catalyst/10.0-specs/stage2.spec (copied) (copied from trunk/catalyst/10.0-specs/stage2.spec )
-
catalyst/10.0-specs/stage3-desktop.spec (copied) (copied from trunk/catalyst/10.0-specs/stage3-desktop.spec )
-
catalyst/10.0-specs/stage3.spec (copied) (copied from trunk/catalyst/10.0-specs/stage3.spec )
-
catalyst/10.0-specs/stage4.spec (copied) (copied from trunk/catalyst/10.0-specs/stage4.spec )
-
ippMonitor/Makefile.in (modified) (1 diff)
-
ippMonitor/def/mopsStatus.d (modified) (3 diffs)
-
ippMonitor/raw/czartool_exposures.php (copied) (copied from trunk/ippMonitor/raw/czartool_exposures.php )
-
ippMonitor/raw/czartool_labels.php (modified) (9 diffs)
-
ippScripts/Build.PL (modified) (1 diff)
-
ippScripts/scripts/addstar_run.pl (modified) (4 diffs)
-
ippScripts/scripts/ipp_apply_burntool_single.pl (modified) (3 diffs)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (4 diffs)
-
ippScripts/scripts/magic_cleanup.pl (copied) (copied from trunk/ippScripts/scripts/magic_cleanup.pl )
-
ippScripts/scripts/magic_destreak.pl (modified) (3 diffs)
-
ippScripts/scripts/magic_destreak_cleanup.pl (modified) (2 diffs)
-
ippScripts/scripts/magic_destreak_defineruns.pl (modified) (3 diffs)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (9 diffs)
-
ippScripts/scripts/nightly_science.pl (modified) (21 diffs)
-
ippScripts/scripts/publish_file.pl (modified) (4 diffs)
-
ippScripts/scripts/register_exp.pl (modified) (1 diff)
-
ippScripts/scripts/register_imfile.pl (modified) (19 diffs)
-
ippTasks/Makefile.am (modified) (1 diff)
-
ippTasks/addstar.pro (modified) (1 diff)
-
ippTasks/diff.pro (modified) (3 diffs)
-
ippTasks/dist.pro (modified) (1 diff)
-
ippTasks/ipphosts.mhpcc.config (modified) (9 diffs)
-
ippTasks/magic.cleanup.pro (copied) (copied from trunk/ippTasks/magic.cleanup.pro )
-
ippTasks/nightly_science.pro (modified) (31 diffs)
-
ippTasks/pstamp.pro (modified) (2 diffs)
-
ippTasks/publish.pro (modified) (3 diffs)
-
ippTasks/register.pro (modified) (11 diffs)
-
ippTasks/survey.pro (modified) (6 diffs)
-
ippTools/share/Makefile.am (modified) (2 diffs)
-
ippTools/share/disttool_pending_SSdiff.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_camera.sql (modified) (2 diffs)
-
ippTools/share/disttool_pending_chip.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_chip_bg.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_diff.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_fake.sql (modified) (2 diffs)
-
ippTools/share/disttool_pending_raw.sql (modified) (9 diffs)
-
ippTools/share/disttool_pending_sky.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_stack.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_warp.sql (modified) (3 diffs)
-
ippTools/share/disttool_pending_warp_bg.sql (modified) (3 diffs)
-
ippTools/share/disttool_revertrun.sql (modified) (1 diff)
-
ippTools/share/magicdstool_todestreak_camera.sql (modified) (1 diff)
-
ippTools/share/magicdstool_torevert_diff.sql (modified) (1 diff)
-
ippTools/share/magictool_setgotocleaned.sql (copied) (copied from trunk/ippTools/share/magictool_setgotocleaned.sql )
-
ippTools/share/magictool_tocleanup.sql (copied) (copied from trunk/ippTools/share/magictool_tocleanup.sql )
-
ippTools/share/pstamptool_pendingreq.sql (modified) (1 diff)
-
ippTools/share/pubtool_pending.sql (modified) (3 diffs)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/share/regtool_checkburntoolimfile.sql (modified) (2 diffs)
-
ippTools/share/regtool_checkstatus.sql (copied) (copied from trunk/ippTools/share/regtool_checkstatus.sql )
-
ippTools/share/regtool_pendingburntoolimfile.sql (modified) (1 diff)
-
ippTools/src/disttool.c (modified) (1 diff)
-
ippTools/src/magicdstool.c (modified) (3 diffs)
-
ippTools/src/magicdstoolConfig.c (modified) (1 diff)
-
ippTools/src/magictool.c (modified) (9 diffs, 1 prop)
-
ippTools/src/magictool.h (modified) (1 diff)
-
ippTools/src/magictoolConfig.c (modified) (2 diffs)
-
ippTools/src/pstamptool.c (modified) (2 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff)
-
ippTools/src/pubtool.c (modified) (1 diff)
-
ippTools/src/pubtoolConfig.c (modified) (1 diff)
-
ippTools/src/pztool.c (modified) (6 diffs)
-
ippTools/src/pztool.h (modified) (1 diff)
-
ippTools/src/pztoolConfig.c (modified) (3 diffs)
-
ippTools/src/regtool.c (modified) (31 diffs)
-
ippTools/src/regtool.h (modified) (1 diff)
-
ippTools/src/regtoolConfig.c (modified) (5 diffs)
-
ippTools/src/stacktool.c (modified) (2 diffs)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (1 diff)
-
pstamp/scripts/pstamp_job_run.pl (modified) (8 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_server_status (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (5 diffs)
-
tools/czarclean.pl (modified) (4 diffs)
-
tools/czarmetrics.pl (modified) (3 diffs)
-
tools/czarplot.pl (modified) (5 diffs)
-
tools/czarpoll.pl (modified) (7 diffs)
-
tools/czartool.pl (modified) (2 diffs)
-
tools/czartool/Config.pm (copied) (copied from trunk/tools/czartool/Config.pm )
-
tools/czartool/CzarDb.pm (modified) (5 diffs)
-
tools/czartool/DayMetrics.pm (modified) (1 diff)
-
tools/czartool/Metrics.pm (modified) (2 diffs)
-
tools/czartool/MetricsIndex.pm (modified) (1 diff)
-
tools/czartool/MultiDayMetrics.pm (modified) (1 diff)
-
tools/czartool/Pantasks.pm (modified) (2 diffs)
-
tools/czartool/Plotter.pm (modified) (7 diffs)
-
tools/czartool/czarconfig.xml (copied) (copied from trunk/tools/czartool/czarconfig.xml )
-
tools/heather/README (copied) (copied from trunk/tools/heather/README )
-
tools/heather/expbot.pl (copied) (copied from trunk/tools/heather/expbot.pl )
-
tools/heather/magic_region.pl (copied) (copied from trunk/tools/heather/magic_region.pl )
-
tools/heather/smf_by_exp_name.pl (copied) (copied from trunk/tools/heather/smf_by_exp_name.pl )
-
tools/refstacktool (copied) (copied from trunk/tools/refstacktool )
-
tools/roboczar.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r29424 r30446 17 17 resolve_project 18 18 getCamRunByCamID 19 runToolAndParse 19 20 parse_md_fast 20 21 ); -
branches/eam_branches/ipp-20101205/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r28048 r30446 29 29 $PSTAMP_SELECT_INVERSE 30 30 $PSTAMP_SELECT_UNCONV 31 $PSTAMP_REQUEST_UNCENSORED 32 $PSTAMP_REQUIRE_UNCENSORED 31 33 $PSTAMP_USE_IMFILE_ID 32 34 $PSTAMP_NO_WAIT_FOR_UPDATE … … 44 46 $PSTAMP_NO_JOBS_QUEUED 45 47 $PSTAMP_NO_OVERLAP 48 $PSTAMP_NOT_AUTHORIZED 46 49 ); 47 50 our %EXPORT_TAGS = (standard => [@EXPORT_OK]); … … 64 67 our $PSTAMP_USE_IMFILE_ID = 16384; 65 68 66 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 69 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 70 our $PSTAMP_REQUEST_UNCENSORED = 1 << 16; 71 our $PSTAMP_REQUIRE_UNCENSORED = 1 << 17; 67 72 68 73 # job and result codes … … 82 87 our $PSTAMP_NO_JOBS_QUEUED = 27; 83 88 our $PSTAMP_NO_OVERLAP = 28; 89 our $PSTAMP_NOT_AUTHORIZED = 29; 84 90 85 91 … … 119 125 PSTAMP_NO_JOBS_QUEUED 120 126 PSTAMP_NO_OVERLAP 127 PSTAMP_NOT_AUTHORIZED 121 128 ); 122 129 -
branches/eam_branches/ipp-20101205/ippMonitor/Makefile.in
r29651 r30446 55 55 $(DESTWWW)/czartool_labels.php \ 56 56 $(DESTWWW)/czartool_getplot.php \ 57 $(DESTWWW)/czartool_exposures.php \ 57 58 $(DESTWWW)/histogram.php \ 58 59 $(DESTWWW)/show_and_delete_image.php \ -
branches/eam_branches/ipp-20101205/ippMonitor/def/mopsStatus.d
r29483 r30446 1 TABLE rawExp LEFT JOIN chipRun using(exp_id) LEFT JOIN camRun using(chip_id) LEFT JOIN fakeRun using(cam_id) LEFT JOIN warpRun using(fake_id) LEFT JOIN diffInputSkyfile AS diffInput ON diffInput.warp1 = warp_id LEFT JOIN diffRun AS diffInputRun ON diffInput.diff_id = diffInputRun.diff_id LEFT JOIN diffInputSkyfile AS diffTemplate ON diffTemplate.warp2 = warp_id LEFT JOIN diffRun AS diffTemplateRun ON diffTemplate.diff_id = diffTemplateRun.diff_id LEFT JOIN publishRun ON stage_id=diffInput.diff_id 1 TABLE rawExp LEFT JOIN chipRun using(exp_id) LEFT JOIN camRun using(chip_id) LEFT JOIN fakeRun using(cam_id) LEFT JOIN warpRun using(fake_id) LEFT JOIN diffInputSkyfile AS diffInput ON diffInput.warp1 = warp_id LEFT JOIN diffRun AS diffInputRun ON diffInput.diff_id = diffInputRun.diff_id LEFT JOIN diffInputSkyfile AS diffTemplate ON diffTemplate.warp2 = warp_id LEFT JOIN diffRun AS diffTemplateRun ON diffTemplate.diff_id = diffTemplateRun.diff_id LEFT JOIN publishRun ON stage_id=diffInput.diff_id AND (client_id=1 OR client_id=5) LEFT JOIN publishRun AS pubRun2 ON pubRun2.stage_id=diffTemplate.diff_id AND (pubRun2.client_id=1 OR pubRun2.client_id=5) LEFT JOIN magicDSRun ON magicDSRun.magic_ds_id=camRun.magicked 2 2 TITLE MOPS Status 3 3 FILE mopsStatus.php … … 10 10 OP OP1 ($row[8]>$row[9]?$row[8]. "(1)":($row[9]!=0?$row[9]. "(2)":"0")) 11 11 # $diffInput.diff_id+$diffTemplate.diff_id 12 OP OP2 $row[8]+$row[9] 13 # "[".$diffInput.diff_id."]:[".$tdiff_id."]" 12 # PUB ID 13 OP OP2 ($row[12]>$row[13]?$row[12]. "(I)":($row[13]!=0?$row[13]. "(T)":"0")) 14 #($row[13]>$row[14]) 14 15 15 16 # field width format name show link to extras 16 FIELD dateobs, 1 5, %T, Date Obs17 FIELD dateobs, 13, %T, Date Obs 17 18 FIELD exp_name, 5, %s, Exp Name 18 19 FIELD rawExp.exp_id, 5, %d, Exp ID 19 20 FIELD chipRun.data_group, 5, %s, Data grp 20 21 FIELD chip_id, 5, %d, Chip ID (Stage 1) 21 FIELD cam _id, 5, %d, Cam ID (Stage 2)22 FIELD camRun.cam_id AS camID, 5, %d, Cam ID (Stage 2) 22 23 FIELD fake_id, 5, %d, Fake ID (Stage 3) 23 24 FIELD warp_id, 5, %d, Warp ID (Stage 4) … … 25 26 FIELD diffTemplate.diff_id AS tdiff_id, 5, %d, tdiff_id, none 26 27 FIELD *, 5, %s, Diff ID (Stage 5), op=OP1 27 #FIELD *, 5, %d, Diff ID (Stage 5), op=OP2 28 FIELD camRun.magicked, 5, %d, Cam Magicked (Stage 6) 29 FIELD publishRun.pub_id, 5, %d, Pub ID (Stage 7) 28 FIELD camRun.magicked, 5, %d, Magick ID (Stage 6) 29 FIELD magicDSRun.magic_ds_id, 5, %d, DestreakID (Stage 7) 30 FIELD publishRun.pub_id AS pubId1, 5, %d, pubId1, none 31 FIELD pubRun2.pub_id AS pubId2, 5, %d, pubId2, none 32 FIELD *, 10, %s, Pub ID, op=OP2 30 33 FIELD filter, 5, %s, Filter 31 34 FIELD object, 15, %s, Object 35 FIELD obs_mode, 5, %s, Obs Mode 32 36 FIELD comment, 40, %s, Comment 33 37 34 FIELD diffInput.diff_id AS ddiffId, 5, %s, ddiffId, none35 FIELD diffTemplate.diff_id AS tdiffId, 5, %s, tdiffId, none38 #FIELD diffInput.diff_id AS ddiffId, 5, %s, ddiffId, none 39 #FIELD diffTemplate.diff_id AS tdiffId, 5, %s, tdiffId, none 36 40 37 41 MODE summary -
branches/eam_branches/ipp-20101205/ippMonitor/raw/czartool_labels.php
r30103 r30446 64 64 include 'version.php'; 65 65 echo "</p>"; 66 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots <br/><a href=\"http://ipp004.ifa.hawaii.edu/clusterMonitor/top.html\">Who uses the cluster?</a><br><a href=\"http://ipp004.ifa.hawaii.edu/ippMetrics\">IPP Metrics</a><br/><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\">Czar log pages</a></p>"; 67 66 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots <br/><a href=\"http://ipp004.ifa.hawaii.edu/clusterMonitor/top.html\">Who uses the cluster?</a><br><a href=\"http://ipp004.ifa.hawaii.edu/ippMetrics\">IPP Metrics</a><br/><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\">Czar log pages</a><br><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\">Exposure summary</a></p>"; 68 67 69 68 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later … … 182 181 echo "<td> \n"; 183 182 $today = date("Y-m-d"); 184 showSummitData($gpc1db, $today);183 createSummitDataTable($gpc1db, $today); 185 184 echo "</td>\n"; 186 185 echo "</tr>\n"; … … 189 188 echo "</tr>\n"; 190 189 191 192 190 # 4th row 191 echo "<tr>\n"; 192 echo "<td> \n"; 193 echo "<table>\n"; 194 echo "<tr valign=top>\n"; 195 echo "<td> \n"; 196 # storage plot 197 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 198 echo "</td>\n"; 199 echo "<td>\n"; 200 createDatesTable($czardb); 201 echo "</td>\n"; 202 echo "</tr>\n"; 203 echo "</table>\n"; 204 echo "</td> \n"; 205 echo "</tr>\n"; 206 207 # 5th row 193 208 echo "<tr>\n"; 194 209 echo "<td>\n"; … … 196 211 echo "<tr valign=top>\n"; 197 212 echo "<td> \n"; 198 # storage plot 199 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 213 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 200 214 echo "</td>\n"; 201 215 echo "<td>\n"; … … 206 220 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 207 221 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 222 208 223 echo "</table>"; 209 224 echo "</td>\n"; … … 213 228 echo "</tr>\n"; 214 229 215 # 5th row216 echo "<tr>\n";217 echo "<td> \n";218 echo "<table>\n";219 echo "<tr valign=top>\n";220 echo "<td> \n";221 # server output222 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer);223 echo "</td>\n";224 echo "<td>\n";225 echo "</td>\n";226 echo "</tr>\n";227 echo "</table>\n";228 echo "</td> \n";229 echo "</tr>\n";230 231 230 echo "</table>\n"; 232 231 … … 236 235 ########################################################################### 237 236 # 238 # C hecks summitExp table agains rawExp table239 # 240 ########################################################################### 241 function showSummitData($gpc1db, $date) {237 # Creates a table of summitExp against rawExp 238 # 239 ########################################################################### 240 function createSummitDataTable($gpc1db, $date) { 242 241 243 242 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; … … 590 589 ########################################################################### 591 590 # 591 # Populates a tables with the current dates listed in the server_dates table 592 # 593 ########################################################################### 594 function createDatesTable($db) { 595 596 $class = "list"; 597 echo "<table class=$class>\n"; 598 echo "<tr><td></td>\n"; 599 write_header_cell($class, "Server"); 600 write_header_cell($class, "Dates"); 601 echo "</tr>\n"; 602 603 createServerDateRow($db, "stdscience"); 604 createServerDateRow($db, "registration"); 605 606 echo "</table>\n"; 607 } 608 609 610 ########################################################################### 611 # 612 # Checks the status of all the pantasks servers 613 # 614 ########################################################################### 615 function createServerDateRow($db, $server) { 616 617 $sql = "SELECT date FROM server_dates WHERE server LIKE '$server' ORDER BY date"; 618 if ($debug) {echo "$sql<br>";} 619 620 $qry = $db->query($sql); 621 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 622 $dates = ""; 623 $firstIn = true; 624 while ($qry->fetchInto($row)) { 625 626 if ($firstIn) { 627 628 $dates = $row[0]; 629 $firstIn = false; 630 } 631 else $dates = $dates . ", " . $row[0]; 632 } 633 634 $class = "list"; 635 echo "<tr><td></td>\n"; 636 write_table_cell($class, '%s', "", $server); 637 write_table_cell($class, '%s', "", $dates); 638 echo "</tr>\n"; 639 640 } 641 642 ########################################################################### 643 # 592 644 # Checks the status of all the pantasks servers 593 645 # … … 633 685 ."&plottype=".$plotType; 634 686 635 $link = ""; # TODO removed links temporarily636 write_table_cell($class, '%s', $link, $server);687 #$link = ""; # TODO removed links temporarily 688 write_table_cell($class, '%s', $link, $server); 637 689 write_table_cell($class, '%s', "", $alive ? "yes" : "NO"); 638 690 -
branches/eam_branches/ipp-20101205/ippScripts/Build.PL
r30102 r30446 58 58 scripts/magic_tree.pl 59 59 scripts/magic_process.pl 60 scripts/magic_cleanup.pl 60 61 scripts/magic_destreak.pl 61 62 scripts/magic_destreak_revert.pl -
branches/eam_branches/ipp-20101205/ippScripts/scripts/addstar_run.pl
r29006 r30446 71 71 defined $camera; 72 72 if ($minidvodb && !defined($minidvodb_group)) { 73 my_die( "missing minidvodb_group", $add_id, 3 );74 }73 my_die( "missing minidvodb_group", $add_id, 3 ); 74 } 75 75 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 76 76 … … 113 113 114 114 if (defined $dvodbReal) { 115 if ($minidvodb) { 116 117 if (!defined($minidvodb_name)) { 118 #take the active one, if it's not defined on the command line 119 #reverts would have this already set, for example. 120 my $command = "addtool -listminidvodbrun "; 121 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 122 $command .= " -state 'active' -limit 1"; 123 $command .= " -dbname $dbname" if defined $dbname; 124 print $command; 125 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 126 run(command => $command, verbose => $verbose); 127 &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success; 128 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 129 &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 130 131 my $components = parse_md_list($metadata) or 132 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 133 my $comp = $$components[0]; 134 $minidvodb_path = $comp->{minidvodb_path}; 135 $minidvodb_name = $comp->{minidvodb_name}; 136 137 if (!defined($minidvodb_path)) { 138 &my_die("Unable to parse minidvodb_path", $add_id, $PS_EXIT_PROG_ERROR); 139 } 140 if (!defined($minidvodb_name)) { 141 &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); 142 } 143 } 144 # tack on the minidvodb part to the db. 145 # $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/'; 146 #we don't need this now that I fixed the paths 147 148 } 115 if ($minidvodb) { 116 117 #if (!defined($minidvodb_name)) { 118 #take the active one, if it's not defined on the command line 119 #reverts would have this already set, for example. 120 my $command = "addtool -listminidvodbrun "; 121 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 122 $command .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 123 $command .= " -state 'active' -limit 1"; 124 $command .= " -dbname $dbname" if defined $dbname; 125 print $command; 126 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 127 run(command => $command, verbose => $verbose); 128 &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success; 129 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 130 &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 131 132 my $components = parse_md_list($metadata) or 133 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 134 my $comp = $$components[0]; 135 $minidvodb_path = $comp->{minidvodb_path}; 136 $minidvodb_name = $comp->{minidvodb_name}; 137 138 if (!defined($minidvodb_path)) { 139 &my_die("Unable to parse minidvodb_path", $add_id, $PS_EXIT_PROG_ERROR); 140 } 141 if (!defined($minidvodb_name)) { 142 &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); 143 } 144 #} 145 # tack on the minidvodb part to the db. 146 # $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/'; 147 #we don't need this now that I fixed the paths 148 149 } 149 150 else { 150 151 … … 153 154 154 155 unless ($no_op) { 155 print $dvodbReal;156 print $dvodbReal; 156 157 157 158 ## addstar can either save the full set of detections, or just … … 222 223 $command .= " -addprocessedexp"; 223 224 $command .= " -fault $exit_code"; 224 $command .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path;225 $command .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path; 225 226 $command .= " -path_base $outroot" if defined $outroot; 226 227 $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400)); 227 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;228 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 228 229 $command .= " -dbname $dbname" if defined $dbname; 229 230 system ($command); -
branches/eam_branches/ipp-20101205/ippScripts/scripts/ipp_apply_burntool_single.pl
r30102 r30446 74 74 unless ($success) { 75 75 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 76 &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);76 &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $class_id, $PS_EXIT_SYS_ERROR); 77 77 } 78 78 79 79 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 80 &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);80 &my_die("Unable to parse metadata config doc", $exp_id, $class_id, $PS_EXIT_SYS_ERROR); 81 81 82 82 my $burntoolStateGood = 999; … … 87 87 } 88 88 if ($burntoolStateGood == 999) { 89 &my_die("Failed to determine BURNTOOL.STATE.GOOD", $ burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);89 &my_die("Failed to determine BURNTOOL.STATE.GOOD", $exp_id, $class_id, $PS_EXIT_SYS_ERROR); 90 90 } 91 91 my $outState = -1 * abs($burntoolStateGood); … … 178 178 my $exp_id = shift; 179 179 my $class_id = shift; 180 vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1);180 vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state 0 -set_state pending_burntool",1); 181 181 } 182 182 printf STDERR "$message\n"; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/ipp_cleanup.pl
r29892 r30446 167 167 # addFilename (\@files, "PPIMAGE.OUTPUT.MASK", $path_base, $class_id); 168 168 # addFilename (\@files, "PPIMAGE.OUTPUT.VARIANCE", $path_base, $class_id); 169 addFilename (\@files, "PPIMAGE.CHIP", $path_base, $class_id );170 addFilename (\@files, "PPIMAGE.CHIP.MASK", $path_base, $class_id );171 addFilename (\@files, "PPIMAGE.CHIP.VARIANCE", $path_base, $class_id );169 addFilename (\@files, "PPIMAGE.CHIP", $path_base, $class_id, 1); 170 addFilename (\@files, "PPIMAGE.CHIP.MASK", $path_base, $class_id, 1); 171 addFilename (\@files, "PPIMAGE.CHIP.VARIANCE", $path_base, $class_id, 1); 172 172 if ($mode eq "goto_purged") { 173 173 # additional files to remove for 'purge' mode … … 429 429 430 430 # delete the temporary image datafiles 431 addFilename(\@files, "PSWARP.OUTPUT", $path_base, $skycell_id );432 addFilename(\@files, "PSWARP.OUTPUT.MASK", $path_base, $skycell_id );433 addFilename(\@files, "PSWARP.OUTPUT.VARIANCE", $path_base, $skycell_id );431 addFilename(\@files, "PSWARP.OUTPUT", $path_base, $skycell_id, 1); 432 addFilename(\@files, "PSWARP.OUTPUT.MASK", $path_base, $skycell_id, 1); 433 addFilename(\@files, "PSWARP.OUTPUT.VARIANCE", $path_base, $skycell_id, 1); 434 434 # addFilename(\@files, "PSWARP.OUTPUT.SOURCES", $path_base, $skycell_id); 435 435 if ($mode eq "goto_purged") { … … 706 706 my @files = (); 707 707 # delete the temporary image datafiles 708 addFilename(\@files, "PPSUB.OUTPUT", $path_base, $skycell_id );709 addFilename(\@files, "PPSUB.OUTPUT.MASK", $path_base, $skycell_id );710 addFilename(\@files, "PPSUB.OUTPUT.VARIANCE", $path_base, $skycell_id );711 712 addFilename(\@files, "PPSUB.INVERSE", $path_base, $skycell_id );713 addFilename(\@files, "PPSUB.INVERSE.MASK", $path_base, $skycell_id );714 addFilename(\@files, "PPSUB.INVERSE.VARIANCE", $path_base, $skycell_id );708 addFilename(\@files, "PPSUB.OUTPUT", $path_base, $skycell_id, 1); 709 addFilename(\@files, "PPSUB.OUTPUT.MASK", $path_base, $skycell_id, 1); 710 addFilename(\@files, "PPSUB.OUTPUT.VARIANCE", $path_base, $skycell_id, 1); 711 712 addFilename(\@files, "PPSUB.INVERSE", $path_base, $skycell_id, 1); 713 addFilename(\@files, "PPSUB.INVERSE.MASK", $path_base, $skycell_id, 1); 714 addFilename(\@files, "PPSUB.INVERSE.VARIANCE", $path_base, $skycell_id, 1); 715 715 716 716 addFilename(\@files, "PPSUB.INPUT.CONV", $path_base, $skycell_id); … … 2048 2048 my $path_base = shift; # base filename 2049 2049 my $class_id = shift; # class_id, if needed 2050 my $recovery = shift; # is there is a recovery file to clean? 2050 2051 2051 2052 my $file = $ipprc->filename($filerule, $path_base, $class_id); 2052 2053 2053 2054 push @$files, $file; 2055 2056 if ($recovery) { 2057 # need to clean up the recovery file (the pixels censored by streaksremove) 2058 $file = $ipprc->recovery_filename($file); 2059 push @$files, $file; 2060 } 2054 2061 return 1; 2055 2062 } -
branches/eam_branches/ipp-20101205/ippScripts/scripts/magic_destreak.pl
r30102 r30446 65 65 'cam_reduction=s'=> \$cam_reduction, # reduction class from camera stage (for chip and raw) 66 66 'outroot=s' => \$outroot, # "directory" for temporary images (may be nebulous) 67 'recoveryroot=s' => \$recoveryroot,# " directory" for saving the images of excised pixels67 'recoveryroot=s' => \$recoveryroot,# "prefix" for saving the images of excised pixels 68 68 'replace=s' => \$replace, # replace the input images with the results. 69 69 'magicked=s' => \$magicked, # magicked state of the run … … 190 190 my $recovery_path_base; 191 191 if ($recoveryroot) { 192 if (!inNebulous($recoveryroot)) { 193 if (! -e $recoveryroot ) { 194 my $code = system "mkdir -p $recoveryroot"; 195 &my_die("cannot create output directory $recoveryroot", $magic_ds_id, $component, 196 $code >> 8) if $code; 197 } 198 } 199 # note: trailing / is necessary 200 $recovery_path_base = "$recoveryroot/$basename/"; 192 # recoveryroot is a path to prepend to the basenames of the input files 193 if (inNebulous($recoveryroot)) { 194 # if recoveryroot is a nebulous path we ignore the actual path and put the files in the 195 # the same "directory" as the input files 196 $recoveryroot = "$dirname/REC_"; 197 $recovery_path_base = $recoveryroot . $basename; 198 } else { 199 # otherwise we put the files in recoveryroot. 200 # Regardless, we prefix the basename with 'REC_' 201 $ipprc->outroot_prepare($recoveryroot); 202 $recovery_path_base = "$recoveryroot/REC_$basename"; 203 } 201 204 } 202 205 … … 601 604 $command .= " -magic_ds_id $magic_ds_id"; 602 605 $command .= " -component $component"; 606 $command .= " -backup_path_base $backup_path_base" if $backup_path_base; 607 $command .= " -recovery_path_base $recovery_path_base" if $recovery_path_base; 603 608 $command .= " -fault $exit_code"; 604 609 $command .= " -dbname $dbname" if defined $dbname; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/magic_destreak_cleanup.pl
r29829 r30446 233 233 $bmask = $ipprc->filename("$name.MASK", $backup_path_base); 234 234 $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base); 235 $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 235 # bills 2011-01-24 236 # don't clean up the uncensored sources file 237 # $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 236 238 } 237 239 if ($recovery_path_base) { … … 251 253 $bmask = $ipprc->filename("$name.MASK", $backup_path_base); 252 254 $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base); 253 $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 255 # bills 2011-01-24 256 # don't clean up the uncensored sources file 257 # $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 254 258 } 255 259 if ($recovery_path_base) { -
branches/eam_branches/ipp-20101205/ippScripts/scripts/magic_destreak_defineruns.pl
r30102 r30446 42 42 43 43 # Parse the command-line arguments 44 my ($stage, $stage_limit, $workdir );44 my ($stage, $stage_limit, $workdir, $recoveryroot); 45 45 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 46 46 my @labels; … … 51 51 'stage_limit=s' => \$stage_limit,# maximum number of runs queued for each stage 52 52 'workdir=s' => \$workdir, # output destination 53 'recoveryroot=s' => \$recoveryroot, # recovery pixels destination 53 54 'dbname=s' => \$dbname, # Database name 54 55 'verbose' => \$verbose, # Print stuff? … … 78 79 foreach my $label (@labels) { 79 80 my $command = "$magicdstool -definebyquery -stage $stage -workdir $workdir -label $label"; 81 $command .= " -recoveryroot $recoveryroot" if $recoveryroot; 80 82 $command .= " -pretend" if $no_update; 81 83 $command .= " -limit $stage_limit" if $stage_limit; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/magic_destreak_revert.pl
r30102 r30446 39 39 # Parse the command-line arguments 40 40 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction, $magicked, $run_state); 41 my ($outroot, $recovery root, $replace, $release, $bytes, $md5sum);41 my ($outroot, $recovery_path_base, $replace, $release, $bytes, $md5sum); 42 42 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 43 43 … … 53 53 'cam_reduction=s'=> \$cam_reduction, # reduction class of the associated camera run 54 54 'outroot=s' => \$outroot, # "directory" for temporary images (may be nebulous) 55 'recovery root=s' => \$recoveryroot,# "directory" for saving the images of excised pixels55 'recovery_path_base=s' => \$recovery_path_base,# "directory" for saving the images of excised pixels 56 56 'replace=s' => \$replace, # replace the input images with the results. 57 57 'bothways=s' => \$bothways, # run has inverse files (bothways diff) … … 130 130 131 131 # default value is "NULL" do not use it 132 if (defined($recovery root) and ($recoveryrooteq "NULL")) {133 $recovery root= undef;132 if (defined($recovery_path_base) and ($recovery_path_base eq "NULL")) { 133 $recovery_path_base = undef; 134 134 } 135 135 … … 149 149 } 150 150 151 my $recovery_path_base;152 if ($recoveryroot) {153 # note: trailing / is necessary154 $recovery_path_base = "$recoveryroot/$basename/";155 }156 157 151 158 152 my ($image, $mask, $ch_mask, $weight, $sources, $astrom); 159 153 my ($bimage, $bmask, $bch_mask, $bweight, $bsources, $bastrom); 154 my ($rimage, $rmask, $rch_mask, $rweight); 160 155 161 156 if ($stage eq "raw") { … … 214 209 $bch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $backup_path_base, $class_id); 215 210 $bweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $backup_path_base, $class_id); 211 212 $rimage = $ipprc->filename("PPIMAGE.CHIP", $recovery_path_base, $class_id); 213 # This is somewhat kludgey but it works whether the mask is camera mask or chip mask 214 $rmask = dirname($recovery_path_base) . "/REC_" . basename($mask); 215 $rch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $recovery_path_base, $class_id); 216 $rweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $recovery_path_base, $class_id); 216 217 } elsif ($stage eq "camera") { 217 218 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $path_base); … … 226 227 $bweight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $backup_path_base); 227 228 $bsources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $backup_path_base); 229 $rimage = $ipprc->filename("PSWARP.OUTPUT", $recovery_path_base); 230 $rmask = $ipprc->filename("PSWARP.OUTPUT.MASK", $recovery_path_base); 231 $rweight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $recovery_path_base); 228 232 } elsif ($stage eq "diff") { 229 233 my $name = "PPSUB.OUTPUT"; … … 236 240 $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base); 237 241 $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 242 if ($recovery_path_base) { 243 $rimage = $ipprc->filename($name, $recovery_path_base); 244 $rmask = $ipprc->filename("$name.MASK", $recovery_path_base); 245 $rweight = $ipprc->filename("$name.VARIANCE", $recovery_path_base); 246 } 238 247 } 239 248 240 249 revert_files($replace, $image, $mask, $weight, $sources, $astrom, $bimage, $bmask, $bweight, $bsources, $bastrom); 250 if ($recovery_path_base) { 251 delete_recovery_files($rimage, $rmask, $rweight, $rch_mask); 252 } 241 253 242 254 if ($stage eq "diff" and $bothways) { … … 251 263 $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 252 264 revert_files($replace, $image, $mask, $weight, $sources, undef, $bimage, $bmask, $bweight, $bsources, undef); 265 if ($recovery_path_base) { 266 $rimage = $ipprc->filename($name, $recovery_path_base); 267 $rmask = $ipprc->filename("$name.MASK", $recovery_path_base); 268 $rweight = $ipprc->filename("$name.VARIANCE", $recovery_path_base); 269 delete_recovery_files($rimage, $rmask, $rweight); 270 } 253 271 } 254 272 … … 426 444 427 445 428 sub file_check 429 { 430 my $file = shift; # Name of file 431 &my_die("Unable to find output file: $file", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR) unless 432 $ipprc->file_exists($file); 446 sub delete_recovery_files 447 { 448 foreach my $file (@_) { 449 if ($ipprc->file_exists($file)) { 450 if (!$ipprc->file_delete($file)) { 451 &my_die("failed to delete recovery file $file", $magic_ds_id, $component, $PS_EXIT_UNKNOWN_ERROR); 452 } 453 } 454 } 433 455 } 434 456 -
branches/eam_branches/ipp-20101205/ippScripts/scripts/nightly_science.pl
r30102 r30446 44 44 my ( $date, $datetime, $camera, $dbname, $logfile, $verbose, $manual); 45 45 my ( $help, $isburning, $force_stack_count, $force_diff_count, $test_mode, $this_target_only, $this_filter_only, $this_mode_only, $check_mode); 46 my ( $registration_status, $burntool_status, $observing_status );46 my ( $registration_status, $burntool_status, $observing_status, $old_date); 47 47 my ( $check_registration, $define_burntool, $queue_burntool, $check_chips, $queue_chips); 48 48 my ( $check_stacks, $queue_stacks, $check_sweetspot, $queue_sweetspot, $check_diffs, $queue_diffs, $clean_old); … … 66 66 'registraion_status' => \$registration_status, 67 67 'burntool_status' => \$burntool_status, 68 'old_date=s' => \$old_date, 68 69 'check_stacks' => \$check_stacks, 69 70 'queue_stacks' => \$queue_stacks, … … 134 135 unless ($success) { 135 136 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 136 &my_die("Unable to perform ppConfigDump: $error_code", $date, $PS_EXIT_SYS_ERROR);137 &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $date, $PS_EXIT_SYS_ERROR); 137 138 } 138 139 … … 278 279 279 280 $metadata_out{nsObservingState} = &get_observing_state($date); 281 $metadata_out{nsRegistrationState} = &get_registration_state($date); 280 282 # 281 283 # Mode selection … … 396 398 exit(0); 397 399 } 398 exit(10); 400 399 401 if (defined($check_confirm_stacks) || defined($test_mode)) { 400 402 $metadata_out{nsStackState} = 'CONFIRM_STACKING'; … … 409 411 exit(0); 410 412 } 411 413 exit(10); 412 414 if (defined($check_sweetspot) || defined($test_mode) || defined($check_mode)) { 413 415 $metadata_out{nsSSState} = 'CHECKSWEETSPOT'; … … 1097 1099 my $pretend = shift; 1098 1100 1101 my $Npotential = 0; 1102 my $Nqueued = 0; 1103 my $is_processing = 0; 1104 my $is_registering; 1105 if ($metadata_out{nsRegistrationState} eq 'REGISTERED') { 1106 $is_registering = 0; 1107 } 1108 else { 1109 $is_registering = 1; 1110 } 1111 1099 1112 foreach my $target (sort (keys %science_config)) { 1100 1113 if ($science_config{$target}{STACKABLE} == 1) { … … 1105 1118 print STDERR "execute_stacks: Target $target on $date is not fully processed. ($NprocChips $NprocWarps)\n"; 1106 1119 } 1120 $is_processing = 1; 1107 1121 $metadata_out{nsStackState} = 'FORCETOWARP'; 1108 1122 next; … … 1120 1134 next; 1121 1135 } 1136 $Npotential++; 1122 1137 if ($Nalready != 0) { 1138 $Nqueued++; 1123 1139 if ($debug == 1) { 1124 1140 print STDERR "execute_stacks: Not queueing $target in filter $filter on $date due to already existing stacks.\n"; … … 1137 1153 } 1138 1154 stack_queue($date,$target,$filter); 1155 $Nqueued ++; 1139 1156 } 1140 1157 if (defined($pretend)) { … … 1152 1169 } 1153 1170 } 1171 $metadata_out{nsStackPotential} = $Npotential; 1172 $metadata_out{nsStackQueued} = $Nqueued; 1173 if (($Npotential == $Nqueued)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)&&($is_registering == 0)) { 1174 $metadata_out{nsStackState} = 'FINISHED_STACKS'; 1175 } 1154 1176 } 1155 1177 … … 1231 1253 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1232 1254 1233 my $sth = "SELECT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where data_group = '$data_group' AND warp1 = $warp_id_1 AND warp2 = $warp_id_2"; 1255 my $count = 0; 1256 1257 my $sth = "SELECT DISTINCT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where data_group = '$data_group' AND warp1 = $warp_id_1 AND warp2 = $warp_id_2"; 1234 1258 my $data_ref = $db->selectall_arrayref( $sth ); 1235 1236 return($#{ $data_ref } + 1); 1259 $count += $#{ $data_ref } + 1; 1260 1261 $sth = "SELECT DISTINCT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where data_group = '$data_group' AND warp1 = $warp_id_2 AND warp2 = $warp_id_1"; 1262 $data_ref = $db->selectall_arrayref( $sth ); 1263 $count += $#{ $data_ref } + 1; 1264 1265 return($count); 1237 1266 } 1238 1267 … … 1272 1301 my $pretend = shift; 1273 1302 1303 my $Npotential = 0; 1304 my $Nnoexp = 0; 1305 my $is_processing = 0; 1306 my $is_registering; 1307 if ($metadata_out{nsRegistrationState} eq 'REGISTERED') { 1308 $is_registering = 0; 1309 } 1310 else { 1311 $is_registering = 1; 1312 } 1313 1274 1314 foreach my $target (sort (keys %science_config)) { 1275 1315 if ($science_config{$target}{DIFFABLE} == 1) { 1276 1316 foreach my $filter (@filter_list) { 1317 $Npotential ++; 1277 1318 my ($NprocChips,$NprocWarps) = pre_diff_queue($date,$observing_state,$target,$filter); 1278 1319 if ((!defined($force_diff_count))&&($NprocChips != $NprocWarps)) { … … 1280 1321 print STDERR "execute_diffs: Target $target in filter $filter on $date is not fully processed. ($NprocChips $NprocWarps)\n"; 1281 1322 } 1282 $metadata_out{nsDiffState} = 'FORCETOWARP'; 1283 next; 1284 } 1323 $is_processing = 1; 1324 } 1285 1325 if ($NprocChips == 0) { 1326 $Nnoexp ++; 1286 1327 if ($debug == 1) { 1287 1328 print STDERR "execute_diffs: Target $target in filter $filter on $date has no exposures.\n"; … … 1311 1352 } 1312 1353 } 1354 if ($debug == 1) { 1355 print "$metadata_out{nsObservingState} $metadata_out{nsDiffPotential} $metadata_out{nsDiffQueued} $is_processing $is_registering\n"; 1356 } 1357 1358 if ($metadata_out{nsObservingState} eq 'END_OF_NIGHT') { 1359 if ($is_processing == 1) { 1360 $metadata_out{nsDiffState} = 'DIFFING'; 1361 } 1362 elsif ($is_registering == 0) { 1363 if ($Npotential == $Nnoexp) { 1364 $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1365 } 1366 elsif ($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued}) { 1367 $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1368 } 1369 } 1370 else { 1371 $metadata_out{nsDiffState} = 'DIFFING'; 1372 } 1373 } 1374 else { 1375 $metadata_out{nsDiffState} = 'DIFFING'; 1376 } 1377 1378 # if (($Npotential == $Nnoexp)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)) { 1379 # $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1380 # } 1381 1382 # if ($is_processing == 1) { 1383 # $metadata_out{nsDiffState} = 'DIFFING'; 1384 # } 1313 1385 } 1314 1386 … … 1326 1398 1327 1399 my $object_ref = $db->selectall_arrayref( $obj_sth ); 1400 1401 my $Npotential = 0; 1402 my $Nqueued = 0; 1328 1403 1329 1404 foreach my $object_row (@{ $object_ref }) { 1330 1405 my $this_object = shift @{ $object_row }; 1331 my $input_sth = "select exp_id,warp_id,dateobsfrom warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) ";1332 $input_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' ";1333 $input_sth .= " ORDER BY dateobs ";1406 # my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1407 # $input_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' "; 1408 # $input_sth .= " ORDER BY dateobs "; 1334 1409 1410 my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state FROM "; 1411 $input_sth .= " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) "; 1412 $input_sth .= " WHERE chipRun.label = '$label' AND chipRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' "; 1413 $input_sth .= " ORDER BY dateobs "; 1414 1335 1415 my $warps = $db->selectall_arrayref( $input_sth ); 1416 1417 # Each comment should only appear once. Therefore, if we see it more than once, we assume the first is extra. 1418 my %comment_hash = (); 1419 foreach my $this_warp (@{ $warps }) { 1420 my $this_comment = ${ $this_warp }[3]; 1421 my $this_exp_id = ${ $this_warp }[0]; 1422 $comment_hash{$this_comment} = $this_exp_id; 1423 } 1336 1424 1337 1425 if (($#{ $warps } + 1) % 2 != 0) { 1338 print STDERR "diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps }\n"; 1339 next; 1426 print STDERR "diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps } "; 1427 if ($#{ $warps} + 1 == 1) { 1428 print STDERR ": I can do no diffs with only one exposure.\n"; 1429 next; 1430 } 1431 else { 1432 print STDERR ": I should declare an exposure to be faulty.\n"; 1433 my @keep_warps = (); 1434 # print "@{ $warps }\n"; 1435 foreach my $this_warp (@{ $warps }) { 1436 my $this_comment = ${ $this_warp }[3]; 1437 my $this_exp_id = ${ $this_warp }[0]; 1438 if ($comment_hash{$this_comment} == $this_exp_id) { 1439 push @keep_warps, $this_warp; 1440 } 1441 else { 1442 print STDERR "diff_queue: excluding $this_exp_id for $this_object\n"; 1443 } 1444 } 1445 @{ $warps } = @keep_warps; 1446 # print "@{ $warps }\n"; 1447 } 1340 1448 } 1341 1449 1342 1450 while ($#{ $warps } > -1) { 1343 1451 my $input_warp = shift @{ $warps }; 1452 my $input_exp_id = ${ $input_warp }[0]; 1453 my $input_comment = ${ $input_warp }[3]; 1454 1455 1344 1456 my $template_warp = shift @{ $warps }; 1345 my $input_exp_id = ${ $input_warp }[0]; 1457 1346 1458 my $template_exp_id = ${ $template_warp }[0]; 1347 1459 1348 1460 my $input_warp_id = ${ $input_warp }[1]; 1349 1461 my $template_warp_id = ${ $template_warp }[1]; 1462 1463 my $input_warp_state = ${ $input_warp }[4]; 1464 my $template_warp_state = ${ $template_warp }[4]; 1350 1465 1466 $Npotential++; 1467 1468 unless (defined($input_warp_id) && defined($template_warp_id) && 1469 ($input_warp_state eq 'full')&&($template_warp_state eq 'full')) { 1470 print STDERR "Diff for this $date $target $input_exp_id $template_exp_id not fully processed\n"; 1471 next; 1472 } 1473 1351 1474 if (verify_uniqueness_diff($input_warp_id,$template_warp_id,$date,$target) != 0) { 1352 print STDERR "Diffs already queued for this $date $target $input_exp_id $template_exp_id\n"; 1475 $Nqueued++; 1476 print STDERR "Diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment\n"; 1353 1477 next; 1354 1478 } … … 1366 1490 $cmd .= ' -pretend '; 1367 1491 print STDERR "diff_queue: $cmd\n"; 1492 print STDERR " $input_warp_id $template_warp_id\n"; 1368 1493 } 1369 1494 … … 1375 1500 &my_die("Unable to perform difftool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1376 1501 } 1377 } 1378 } 1379 } 1502 $Nqueued++; 1503 } 1504 } 1505 } 1506 $metadata_out{nsDiffPotential} += $Npotential; 1507 $metadata_out{nsDiffQueued} += $Nqueued; 1508 # if (($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued})&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) { 1509 # $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1510 # } 1511 1380 1512 } 1381 1513 … … 1493 1625 } 1494 1626 } 1495 1627 # print "$datetime $eon_dt\n"; 1496 1628 if (DateTime->compare($datetime,$eon_dt) < 1) { 1497 1629 return("OBSERVING"); … … 1501 1633 } 1502 1634 } 1635 1636 # This basically does the end of night check, but does it "the hard way," to prevent the time from fooling us. 1637 sub get_registration_state { 1638 my $date = shift; 1639 1640 foreach my $eon (keys %eon_config) { 1641 my $command = "$regtool -processedexp -simple "; 1642 $command .= " -dbname $dbname "; 1643 $command .= " -dateobs_begin ${date}T00:00:00 -dateobs_end ${date}T23:59:59 "; 1644 $command .= " -object $eon_config{$eon}{OBJECT} " if defined($eon_config{$eon}{OBJECT}); 1645 $command .= " -obs_mode $eon_config{$eon}{OBSMODE} " if defined($eon_config{$eon}{OBSMODE}); 1646 $command .= " -exp_type $eon_config{$eon}{EXPTYPE} " if defined($eon_config{$eon}{EXPTYPE}); 1647 $command .= " -comment $eon_config{$eon}{COMMENT} " if defined($eon_config{$eon}{COMMENT}); 1648 1649 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1650 run ( command => $command, verbose => $verbose ); 1651 unless ($success) { 1652 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1653 &my_die("Unable to perform regtool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1654 } 1655 my @eon_exposures = split /\n/, (join '', @$stdout_buf); 1656 if ($#eon_exposures >= 0) { 1657 return("REGISTERED"); 1658 } 1659 } 1660 return("NOT_REGISTERED"); 1661 } 1662 1663 1503 1664 1504 1665 sub get_tool_parameters { … … 1620 1781 my $stage = shift; # stage name 1621 1782 my $stage_id = shift; # identifier 1783 my $date = shift; 1622 1784 my $exit_code = shift; # Exit code 1623 # outputImage and path_base are globals1624 1785 1625 1786 carp($msg); -
branches/eam_branches/ipp-20101205/ippScripts/scripts/publish_file.pl
r30102 r30446 42 42 43 43 # Parse the command-line arguments 44 my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir );44 my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir, $need_magic ); 45 45 my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect ); 46 46 my ( $output_format ); … … 54 54 'fileset=s' => \$fileset, # Fileset name 55 55 'workdir=s' => \$workdir, # Working directory 56 'need-magic' => \$need_magic, # do we require censored detections? 56 57 'dbname=s' => \$dbname, # Database name 57 58 'verbose' => \$verbose, # Print to stdout … … 166 167 foreach my $comp ( @$components ) { 167 168 my $path_base = $comp->{path_base}; # Base name for file 169 if (!$need_magic and $comp->{magicked}) { 170 # This client is authorized to receive uncensored detections 171 # Get the uri for the "backup" files 172 print "Using uncensored input from $path_base\n"; 173 $path_base = $ipprc->destreaked_filename($path_base); 174 } 168 175 next if defined $comp->{quality} and $comp->{quality} > 0; 169 176 print "Warning: mis-matched comments\n" if defined $comment and $comment ne $comp->{comment}; … … 181 188 $filename = $ipprc->filename( "PSPHOT.OUT.CMF.MEF", "$path_base.pos" ); 182 189 } 183 $filename = $ipprc->file_resolve($filename); 190 &my_die("input file does not exist: $filename", $pub_id, $PS_EXIT_SYS_ERROR) if !$ipprc->file_exists($filename); 191 my $resolved = $ipprc->file_resolve($filename); 192 193 &my_die("unable to resolve input file: $filename", $pub_id, $PS_EXIT_SYS_ERROR) if !$resolved; 194 195 $filename = $resolved; 184 196 185 197 my $data = { zp => $zp, -
branches/eam_branches/ipp-20101205/ippScripts/scripts/register_exp.pl
r30102 r30446 348 348 if (defined $exp_id and not $no_update) { 349 349 my $command = "$regtool -addprocessedexp -exp_id $exp_id -fault $exit_code"; 350 $command .= " -exp_tag $exp_tag"; 351 $command .= " -exp_name UNKNOWN"; 352 $command .= " -inst UNKNOWN"; 353 $command .= " -telescope UNKNOWN"; 354 $command .= " -telescope UNKNOWN"; 355 $command .= " -filelevel UNKNOWN"; 350 356 $command .= " -hostname $host" if defined $host; 351 357 $command .= " -dbname $dbname" if defined $dbname; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/register_imfile.pl
r30102 r30446 10 10 my $date = `date`; 11 11 print "\n\n"; 12 print "Starting script $0 on $host at $date\n\n"; 12 my $cmd_line = join ' ', @ARGV; 13 print "Starting script $0 $cmd_line on $host at $date\n\n"; 13 14 14 15 use vars qw( $VERSION ); … … 39 40 40 41 my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile); 42 my ($sunrise, $sunset); 41 43 GetOptions( 42 44 'caches' => \$cache, … … 47 49 'bytes=s' => \$bytes, 48 50 'md5sum=s' => \$md5sum, 51 'sunrise=s' => \$sunrise, 52 'sunset=s' => \$sunset, 49 53 'dbname|d=s' => \$dbname, # Database name 50 54 'verbose' => \$verbose, # Print to stdout … … 54 58 ) or pod2usage( 2 ); 55 59 56 my $ipprc = PS::IPP::Config->new() or my_die ( "Unable to set up", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR ); # IPP configuration57 $ipprc->redirect_output($logfile) or my_die ( "Unable to redirect output", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_SYS_ERROR ) if $logfile;60 my $ipprc = PS::IPP::Config->new() or my_die_for_add( "Unable to set up", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 61 $ipprc->redirect_output($logfile) or my_die_for_add( "Unable to redirect output", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_SYS_ERROR ) if $logfile; 58 62 59 63 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; … … 65 69 defined $uri; 66 70 71 unless (defined($sunset)) { 72 $sunset = '03:30:00'; 73 } 74 unless (defined($sunrise)) { 75 $sunrise = '17:30:00'; 76 } 67 77 68 78 my $RECIPE = "REGISTER"; # Recipe to use for ppStats … … 84 94 85 95 my $cmdflags; 86 my $burntoolStateGood; 96 my $burntoolStateTarget; 97 my $burntoolStateCurrent; 87 98 # Run ppStats on the input file 88 99 { … … 101 112 print "STDOUT:\n$out1"; 102 113 print "STDERR:\n$err1"; 103 &my_die ("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h1->result() or $PS_EXIT_PROG_ERROR) ) unless $result1;114 &my_die_for_add("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h1->result() or $PS_EXIT_PROG_ERROR) ) unless $result1; 104 115 105 116 print "[Running " . join(' ', @command2) . "]\n"; … … 110 121 print "STDOUT:\n$out2"; 111 122 print "STDERR:\n$err2"; 112 &my_die ("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h2->result() or $PS_EXIT_PROG_ERROR) ) unless $result2;123 &my_die_for_add("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, ($h2->result() or $PS_EXIT_PROG_ERROR) ) unless $result2; 113 124 chomp $out2; 114 125 $cmdflags = $out2; 115 126 116 127 # Manually parse the burntool_state entry. 117 my $burntoolState= 0;128 $burntoolStateCurrent = 0; 118 129 my $isGPC1 = 0; 119 $burntoolState Good= 0;130 $burntoolStateTarget = 0; 120 131 foreach my $line (split /\n/, $out1) { 121 132 if ($line =~ /FPA.BURNTOOL.APPLIED/) { 122 133 $line =~ s/^\s+//; 123 $burntoolState = (split /\s+/, $line)[2];134 $burntoolStateCurrent = (split /\s+/, $line)[2]; 124 135 } 125 136 if ($line =~ /FPA.CAMERA/) { … … 131 142 } 132 143 if ($isGPC1 != 1) { 133 $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.134 } 135 elsif (($isGPC1 == 1) && ($burntoolState == 1)) {136 # print STDERR "In the good region: >>$burntoolState <<\n";144 $burntoolStateCurrent = 0; # If it's not GPC1, you shouldn't have run burntool. 145 } 146 elsif (($isGPC1 == 1) && ($burntoolStateCurrent == 1)) { 147 # print STDERR "In the good region: >>$burntoolStateCurrent<<\n"; 137 148 my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -"; 138 149 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 148 159 if ($line =~ /BURNTOOL.STATE.GOOD/) { 149 160 $line =~ s/^\s+//; 150 $burntoolState Good= (split /\s+/, $line)[2];161 $burntoolStateTarget = (split /\s+/, $line)[2]; 151 162 last; 152 163 } 153 164 } 154 $burntoolState = $burntoolStateGood; # Positive because this has the header table. 155 156 } 157 $cmdflags .= " -burntool_state $burntoolState "; 165 # XXX why was this being equated?? 166 # $burntoolState = $burntoolStateGood; # Positive because this has the header table. 167 168 } 169 $cmdflags .= " -burntool_state $burntoolStateTarget "; 158 170 } 159 171 160 172 $now_time = localtime(); 161 173 printf STDERR "\ndone with ppStats: %s\n", $now_time if $verbose; 174 printf STDERR "\nburntool state current: %d target: %d\n", $burntoolStateCurrent, $burntoolStateTarget; 162 175 163 176 # we require at a minimum: -telescope, -inst, -filelevel, -class_id, -exp_type 164 if (uc(&value_for_flag ($cmdflags, "NULL", "-telescope")) eq "NULL") { &my_die ("telescope not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 165 if (uc(&value_for_flag ($cmdflags, "NULL", "-inst")) eq "NULL") { &my_die ("inst not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 166 if (uc(&value_for_flag ($cmdflags, "NULL", "-filelevel")) eq "NULL") { &my_die ("filelevel not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 167 if (uc(&value_for_flag ($cmdflags, "NULL", "-class_id")) eq "NULL") { &my_die ("class_id not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 168 if (uc(&value_for_flag ($cmdflags, "NULL", "-exp_type")) eq "NULL") { &my_die ("exp_type not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 177 if (uc(&value_for_flag ($cmdflags, "NULL", "-telescope")) eq "NULL") { &my_die_for_add ("telescope not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 178 if (uc(&value_for_flag ($cmdflags, "NULL", "-inst")) eq "NULL") { &my_die_for_add ("inst not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 179 if (uc(&value_for_flag ($cmdflags, "NULL", "-filelevel")) eq "NULL") { &my_die_for_add ("filelevel not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 180 if (uc(&value_for_flag ($cmdflags, "NULL", "-class_id")) eq "NULL") { &my_die_for_add ("class_id not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 181 if (uc(&value_for_flag ($cmdflags, "NULL", "-exp_type")) eq "NULL") { &my_die_for_add ("exp_type not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); } 182 my $dateobs = &value_for_flag($cmdflags, 0.0, "-dateobs"); 169 183 170 184 my $command = "$regtool -addprocessedimfile"; … … 177 191 $command .= " -hostname $host" if defined $host; 178 192 $command .= " -dbname $dbname" if defined $dbname; 179 $command .= " -data_state check_burntool"; 193 if (abs($burntoolStateCurrent) == $burntoolStateTarget) { 194 printf STDERR "This has already been burned.\n"; 195 $command .= " -data_state full"; 196 } 197 elsif (is_daytime($dateobs,$sunrise,$sunset)) { 198 printf STDERR "This is a daytime exposure.\n"; 199 $command .= " -data_state full"; 200 } 201 else { 202 printf STDERR "Need to check burntool.\n"; 203 $command .= " -data_state check_burntool"; 204 } 180 205 $command .= " $cmdflags"; 181 206 … … 187 212 my $ra = &value_for_flag($cmdflags, 0.0, "-ra"); 188 213 my $dec = &value_for_flag($cmdflags, 0.0, "-decl"); 189 my $dateobs = &value_for_flag($cmdflags, 0.0, "-dateobs"); 214 190 215 191 216 # if the needed data is available, pass it to sunmoon: … … 216 241 # lock file? 217 242 # if exp_type = DARK and date > MIDNIGHT HST { wait } 218 # system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log"); 243 # system("ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $date_start --dateobs_end $date_end --dbname gpc1 --logfile /data/$host.0/burntool_logs/$class_id.$start_date.log"); 219 244 220 245 $now_time = localtime(); … … 236 261 # We now have an imfile in the database, check if we can burntool it. If not, continue on. 237 262 238 { 263 if ((abs($burntoolStateCurrent) != $burntoolStateTarget)&& 264 (!is_daytime($dateobs,$sunrise,$sunset))) { 239 265 my $mdcParser = PS::IPP::Metadata::Config->new; 240 266 … … 243 269 $check_date =~ s/T.*$//; 244 270 my $exp_name = $tmp_exp_name; 245 271 246 272 247 273 my $bt_check_command = "$regtool -checkburntoolimfile "; 248 274 $bt_check_command .= " -class_id $class_id "; 249 $bt_check_command .= " -date $check_date "; 250 $bt_check_command .= " -valid_burntool $burntoolStateGood "; 275 $bt_check_command .= " -dateobs_begin ${check_date}T${sunset} "; 276 $bt_check_command .= " -dateobs_end ${check_date}T${sunrise} "; 277 $bt_check_command .= " -valid_burntool $burntoolStateTarget "; 251 278 $bt_check_command .= " -exp_name $exp_name "; 252 279 $bt_check_command .= " -dbname $dbname" if defined $dbname; 253 280 254 281 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 255 run ( command => $bt_check_command, verbose => $verbose);282 run ( command => $bt_check_command, verbose => $verbose); 256 283 unless ($success) { 257 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);258 &my_die("Unable to perform regtool: $error_code", 259 $class_id, $exp_name, $date, $PS_EXIT_SYS_ERROR);284 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 285 &my_die_for_update("Unable to perform regtool: $error_code", 286 $exp_id, $class_id, $PS_EXIT_SYS_ERROR); 260 287 } 261 288 … … 264 291 my $exposures; 265 292 while ( scalar @whole > 0 ) { 266 my $value = shift @whole;267 push @single, $value;268 if ($value =~ /^\s*END\s*$/) {269 push @single, "\n";270 271 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) );272 &my_die("Unable to parse output from regtool", 273 $class_id, $exp_name, $date, $PS_EXIT_SYS_ERROR) unless274 defined $list;275 push @{ $exposures }, @$list;276 @single = ();277 }278 } 279 293 my $value = shift @whole; 294 push @single, $value; 295 if ($value =~ /^\s*END\s*$/) { 296 push @single, "\n"; 297 298 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ); 299 &my_die_for_update("Unable to parse output from regtool", 300 $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless 301 defined $list; 302 push @{ $exposures }, @$list; 303 @single = (); 304 } 305 } 306 280 307 # We only care about the final entry, as that contains the exposure we are. 281 308 282 309 my $regtool_update = "$regtool -updateprocessedimfile "; 283 310 $regtool_update .= "-dbname $dbname " if defined $dbname; … … 286 313 my $burntool_data = pop(@{ $exposures }); 287 314 if ($burntool_data->{burnable} == 0) { 288 $regtool_update .= " -burntool_state 0 -set_state pending_burntool "; 315 $regtool_update .= " -burntool_state 0 -set_state pending_burntool "; 316 unless ($no_update) { 317 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 318 IPC::Cmd::run(command => $regtool_update, verbose => $verbose); 319 unless ($success) { 320 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 321 warn ("Unable to perform regtool -addprocessedimfile: $error_code"); 322 exit($error_code); 323 } 324 } else { 325 print "skipping command: $command\n"; 326 } 289 327 } 290 328 else { 291 my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname "; 292 $apply_command .= " --class_id $class_id --exp_id $exp_id "; 293 $apply_command .= " --this_uri $burntool_data->{uri} "; 294 $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri}; 295 $apply_command .= " --imfile_state $burntool_data->{imfile_state} "; 296 $apply_command .= " --verbose " if $verbose; 297 print "$apply_command\n"; 298 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 299 IPC::Cmd::run(command => $apply_command, verbose => $verbose); 300 unless ($success) { 301 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 302 warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code"); 303 exit($error_code); 304 } 305 } 306 307 unless ($no_update) { 308 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 309 IPC::Cmd::run(command => $regtool_update, verbose => $verbose); 310 unless ($success) { 311 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 312 warn ("Unable to perform regtool -addprocessedimfile: $error_code"); 313 exit($error_code); 314 } 315 } else { 316 print "skipping command: $command\n"; 317 } 329 my $apply_command = "$ippApplyBurntoolSingle --dbname $dbname "; 330 $apply_command .= " --class_id $class_id --exp_id $exp_id "; 331 $apply_command .= " --this_uri $burntool_data->{uri} "; 332 $apply_command .= " --previous_uri $burntool_data->{previous_uri} " if defined $burntool_data->{previous_uri}; 333 $apply_command .= " --imfile_state $burntool_data->{imfile_state} "; 334 $apply_command .= " --verbose " if $verbose; 335 print "$apply_command\n"; 336 unless ($no_update) { 337 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 338 IPC::Cmd::run(command => $apply_command, verbose => $verbose); 339 unless ($success) { 340 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 341 &my_die_for_update("Unable to perform ipp_apply_burntool_single.pl: $error_code", 342 $exp_id, $class_id, $PS_EXIT_SYS_ERROR); 343 } 344 } 345 } 346 318 347 319 348 } … … 351 380 } 352 381 353 sub my_die 382 sub is_daytime 383 { 384 my $dateobs = shift; 385 my $sunset = shift; 386 my $sunrise = shift; 387 388 my ($date,$time); 389 390 if ($dateobs =~ /T/) { 391 ($date,$time) = split /T/, $dateobs; 392 } 393 else { 394 ($date,$time) = split / /, $dateobs; 395 } 396 my ($hour,$minute,$second) = split /\:/, $time; # /; 397 my ($ss_hour,$ss_minute,$ss_second) = split /\:/, $sunset; # /; 398 my ($sr_hour,$sr_minute,$sr_second) = split /\:/, $sunrise; # /; 399 if ($second =~ /Z/) { 400 $second =~ s/Z//; 401 } 402 # print "this exposure: $hour $minute $second\n"; 403 # print "sunset: $ss_hour $ss_minute $ss_second\n"; 404 # print "sunrise: $sr_hour $sr_minute $sr_second\n"; 405 # printf "Hss: %d Mss: %d Sss: %d\n",($hour >= $ss_hour),($minute >= $ss_minute),($second >= $ss_second); 406 # printf "Hsr: %d Msr: %d Ssr: %d\n",($hour <= $sr_hour),($minute <= $sr_minute),($second <= $sr_second); 407 408 if (($hour > $ss_hour)&&($hour <= 24)) { 409 return(1); # After sunset by more than an hour, before midnight 410 } 411 elsif ($hour == $ss_hour) { 412 if ($minute > $ss_minute) { 413 return(1); # After sunset by more than a minute 414 } 415 elsif ($minute == $ss_minute) { 416 if ($second >= $ss_second) { 417 return(1); # After sunset by more than a second 418 } 419 else { 420 return(0); 421 } 422 } 423 else { 424 return(0); 425 } 426 } 427 elsif (($hour < $sr_hour)&&($hour >= 0)) { 428 return(1); # Before sunrise by more than an hour, but after midnight 429 } 430 elsif ($hour == $sr_hour) { 431 if ($minute < $sr_minute) { 432 return(1); # Before sunrise by more than a minute 433 } 434 elsif ($minute == $sr_minute) { 435 if ($second <= $sr_second) { 436 return(1); # Before sunrise by more than a second 437 } 438 else { 439 return(0); 440 } 441 } 442 else { 443 return(0); 444 } 445 } 446 else { 447 return(0); # We should never get here. 448 } 449 } 450 451 sub my_die_for_add 354 452 { 355 453 my $msg = shift; # Warning message on die … … 382 480 exit $exit_code; 383 481 } 482 sub my_die_for_update 483 { 484 my $msg = shift; # Warning message on die 485 my $exp_id = shift; 486 my $class_id = shift; 487 my $exit_code = shift; 488 489 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 490 491 carp($msg); 492 if (defined $exp_id && defined $tmp_class_id and not $no_update) { 493 my $command = "$regtool -updateprocessedimfile"; 494 $command .= " -exp_id $exp_id"; 495 $command .= " -class_id $class_id"; 496 $command .= " -fault $exit_code"; 497 $command .= " -hostname $host" if defined $host; 498 $command .= " -dbname $dbname" if defined $dbname; 499 print "Running: $command\n"; 500 system($command); 501 } 502 exit $exit_code; 503 } 384 504 385 505 # Pau. -
branches/eam_branches/ipp-20101205/ippTasks/Makefile.am
r30102 r30446 17 17 warp.pro \ 18 18 magic.pro \ 19 magic.cleanup.pro \ 19 20 destreak.pro \ 20 21 destreak.cleanup.pro \ -
branches/eam_branches/ipp-20101205/ippTasks/addstar.pro
r28211 r30446 173 173 $run = $run --minidvodb_group $MINIDVODB_GROUP 174 174 if (("$MINIDVODB_NAME" != "NULL") && ("$MINIDVODB_NAME" != "(null)")) 175 $run = $run --minidvodb_name $MINIDVODB_NAME #have addstar_run.pl grab the 'active' name if it is NULL 175 $run = $run --minidvodb_name $MINIDVODB_NAME 176 #have addstar_run.pl grab the 'active' name if it is NULL 176 177 end 177 178 end -
branches/eam_branches/ipp-20101205/ippTasks/diff.pro
r28375 r30446 45 45 end 46 46 task diff.revert 47 active false47 active true 48 48 end 49 49 task diff.summary.load … … 448 448 periods -timeout 120.0 449 449 npending 1 450 active false451 450 452 451 stdout NULL … … 457 456 # Only revert failures with fault=2 (SYS_ERROR), which tend to be 458 457 # temporary filesystem problems. Every other fault type is 459 # interesting and should be kept for debugging (and so it does n't458 # interesting and should be kept for debugging (and so it does not 460 459 # continue to occur). 461 $run = difftool -revertdiffskyfile -fault 2 460 # XXX: actually we are getting enough jobs with fault 4 that work after reverting 461 # that we are going to remove that cut for now 462 # 463 #$run = difftool -revertdiffskyfile -fault 2 464 $run = difftool -revertdiffskyfile 462 465 if ($DB:n == 0) 463 466 option DEFAULT -
branches/eam_branches/ipp-20101205/ippTasks/dist.pro
r29386 r30446 61 61 end 62 62 task dist.revert 63 active false63 active true 64 64 end 65 65 end -
branches/eam_branches/ipp-20101205/ippTasks/ipphosts.mhpcc.config
r28500 r30446 22 22 sky09 STR ipp014 23 23 sky10 STR ipp015 24 sky11 STR ipp0 1624 sky11 STR ipp006 25 25 sky12 STR ipp017 26 26 sky13 STR ipp018 … … 125 125 XY26 STR ipp027 126 126 XY27 STR ipp028 127 XY30 STR ipp0 16127 XY30 STR ipp006 128 128 XY31 STR ipp044 129 129 … … 204 204 ota26 STR ipp027 205 205 ota27 STR ipp028 206 ota30 STR ipp0 16206 ota30 STR ipp006 207 207 ota31 STR ipp044 208 208 … … 298 298 XY11 STR ipp039 299 299 300 XY12 STR ipp00 9300 XY12 STR ipp005 301 301 XY13 STR ipp024 302 302 XY14 STR ipp010 … … 305 305 XY16 STR ipp011 306 306 XY17 STR ipp026 307 XY20 STR ipp0 12307 XY20 STR ipp006 308 308 XY21 STR ipp041 309 309 310 310 XY22 STR ipp013 311 311 XY23 STR ipp042 312 XY24 STR ipp0 14312 XY24 STR ipp007 313 313 XY25 STR ipp043 314 314 315 315 XY26 STR ipp027 316 316 XY27 STR ipp028 317 XY30 STR ipp0 16317 XY30 STR ipp006 318 318 XY31 STR ipp044 319 319 … … 358 358 XY72 STR ipp052 359 359 360 XY73 STR ipp0 53360 XY73 STR ipp007 361 361 XY74 STR ipp015 362 362 XY75 STR ipp025 … … 371 371 sky02 STR ipp007 372 372 sky03 STR ipp008 373 sky04 STR ipp00 9373 sky04 STR ipp005 374 374 sky05 STR ipp010 375 375 sky06 STR ipp011 376 sky07 STR ipp0 12376 sky07 STR ipp006 377 377 sky08 STR ipp013 378 sky09 STR ipp0 14378 sky09 STR ipp007 379 379 sky10 STR ipp015 380 sky11 STR ipp0 16380 sky11 STR ipp006 381 381 sky12 STR ipp017 382 382 sky13 STR ipp018 … … 414 414 sky45 STR ipp051 415 415 sky46 STR ipp052 416 sky47 STR ipp0 53416 sky47 STR ipp007 417 417 sky48 STR ipp023 418 418 sky49 STR ipp024 … … 445 445 sky76 STR ipp051 446 446 sky77 STR ipp052 447 sky78 STR ipp0 53448 END 447 sky78 STR ipp006 448 END -
branches/eam_branches/ipp-20101205/ippTasks/nightly_science.pro
r30102 r30446 7 7 ns.detrends.off 8 8 ns.dqstats.on 9 # ns.sweetspot.on10 # ns.registration.on11 # ns.burntool.on12 # ns.chips.on13 9 ns.stacks.on 14 10 ns.diffs.on … … 19 15 ns.detrends.off 20 16 ns.dqstats.off 21 # ns.sweetspot.off22 # ns.registration.off23 # ns.burntool.off24 # ns.chips.off25 17 ns.stacks.off 26 18 ns.diffs.off … … 53 45 end 54 46 55 # macro ns.sweetspot.on56 # task ns.sweetspot.load57 # active true58 # end59 # end60 61 # macro ns.registration.on62 # task ns.registration.load63 # active true64 # end65 # end66 67 # macro ns.burntool.on68 # task ns.burntool.load69 # active true70 # end71 # task ns.burntool.run72 # active true73 # end74 # end75 76 # macro ns.chips.on77 # task ns.chips.load78 # active true79 # end80 # task ns.chips.run81 # active true82 # end83 # end84 85 47 macro ns.stacks.on 86 48 task ns.stacks.load … … 91 53 end 92 54 task ns.stacks.confirm 93 active true55 active false 94 56 end 95 57 end … … 122 84 end 123 85 124 # macro ns.sweetspot.off125 # task ns.sweetspot.load126 # active false127 # end128 # end129 130 # macro ns.registration.off131 # task ns.registration.load132 # active false133 # end134 # end135 136 # macro ns.burntool.off137 # task ns.burntool.load138 # active false139 # end140 # task ns.burntool.run141 # active false142 # end143 # end144 145 # macro ns.chips.off146 # task ns.chips.load147 # active false148 # end149 # task ns.chips.run150 # active false151 # end152 # end153 154 86 macro ns.stacks.off 155 87 task ns.stacks.load … … 174 106 end 175 107 176 # $ns_regPAGE = 0 177 # $ns_burnPAGE = 0 178 # $ns_RburnPAGE = 0 179 # $ns_RburnCELL = 0 180 # $ns_chipPAGE = 0 181 # $ns_RchipPAGE = 0 108 macro ns.stacks.confirm.on 109 task ns.stacks.confirm 110 active true 111 end 112 end 113 114 macro ns.stacks.confirm.off 115 task ns.stacks.confirm 116 active false 117 end 118 end 119 120 182 121 $ns_stackPAGE = 0 183 122 $ns_RstackPAGE = 0 … … 187 126 188 127 book init nsData 128 book init nsDiffs 129 book init nsStacks 189 130 # 190 131 # Macros to control the book. 191 132 # 192 133 macro ns.add.date 134 if ($0 != 2) 135 echo "USAGE: ns.add.date (YYYY-MM-DD)" 136 break 137 end 138 193 139 book newpage nsData $1 194 140 book setword nsData $1 nsState NEW 195 book setword nsData $1 nsStackState TOWARP 196 book setword nsData $1 nsDiffState TOWARP 141 book setword nsData $1 dbname $DB:0 142 143 book newpage nsDiffs $1 144 book setword nsDiffs $1 nsDiffState TOWARP 145 book setword nsDiffs $1 nsObservingState UNKNOWN 146 147 book newpage nsStacks $1 148 book setword nsStacks $1 nsStackState TOWARP 149 197 150 end 198 151 … … 202 155 book getpage nsData $i -var date 203 156 book getword nsData $date nsState -var state 204 book getword ns Data$date nsStackState -var Sstate205 book getword nsD ata$date nsDiffState -var Dstate206 book getword nsD ata$date nsObservingState -var Ostate157 book getword nsStacks $date nsStackState -var Sstate 158 book getword nsDiffs $date nsDiffState -var Dstate 159 book getword nsDiffs $date nsObservingState -var Ostate 207 160 echo $date $state $Sstate $Dstate $Ostate 208 161 end … … 216 169 book setword nsData $1 nsState $2 217 170 end 218 219 171 220 172 … … 236 188 book newpage nsData $today 237 189 book setword nsData $today nsState NEW 238 book setword nsData $today nsStackState TOWARP 239 book setword nsData $today nsDiffState TOWARP 190 book newpage nsStacks $today 191 book setword nsStacks $today nsStackState TOWARP 192 book newpage nsDiffs $today 193 book setword nsDiffs $today nsDiffState TOWARP 240 194 book setword nsData $today dbname $DB:0 241 195 242 196 # command echo $today 243 197 $run = nightly_science.pl --clean_old --date $today --dbname $DB:0 244 add_standard_args $run198 # add_standard_args run 245 199 command $run 246 200 end … … 279 233 280 234 $run = nightly_science.pl --queue_detrends --date $today --dbname $DB:0 281 add_standard_args $run235 # add_standard_args $run 282 236 command $run 283 237 end … … 317 271 318 272 $run = nightly_science.pl --queue_dqstats --date $today --dbname $DB:0 319 add_standard_args $run273 # add_standard_args $run 320 274 command $run 321 275 … … 342 296 # 343 297 task ns.stacks.load 298 active false 344 299 host local 345 300 periods -poll $LOADPOLL … … 353 308 354 309 book getpage nsData $ns_stackPAGE -var date 355 book getword nsData $date nsStackState -var ns_STATE 356 book getword nsData $date dbname -var $DBNAME 310 book getword nsStacks $date nsStackState -var ns_STATE 311 book getword nsDiffs $date nsDiffState -var ns_diff_STATE 312 book getword nsData $date dbname -var DBNAME 357 313 book npages nsData -var Npages 358 314 … … 367 323 if ("$ns_STATE" != "TOWARP") break 368 324 369 $run = nightly_science.pl --check_stacks --date $date 370 add_standard_args $run325 $run = nightly_science.pl --check_stacks --date $date --dbname $DBNAME 326 # add_standard_args $run 371 327 command $run 372 328 … … 376 332 task.exit 0 377 333 # convert 'stdout' to book format 378 book delpage ns Data$options:0379 ipptool2book stdout ns Data-uniq -key date380 381 book getword ns Data$options:0 nsNmacros -var ns_Nmacros334 book delpage nsStacks $options:0 335 ipptool2book stdout nsStacks -uniq -key date 336 337 book getword nsStacks $options:0 nsNmacros -var ns_Nmacros 382 338 if ("$ns_Nmacros" != "NULL") 383 339 for i 0 $ns_Nmacros 384 340 sprintf macroName "ns%dMacro" $i 385 book getword ns Data$options:0 $macroName -var macroCmd341 book getword nsStacks $options:0 $macroName -var macroCmd 386 342 $macroCmd 387 343 end … … 422 378 423 379 book getpage nsData $ns_RstackPAGE -var date 424 book getword nsData $date nsStackState -var ns_STATE 425 book getword nsData $date dbname -var $DBNAME 380 book getword nsStacks $date nsStackState -var ns_STATE 381 book getword nsDiffs $date nsDiffState -var ns_diff_STATE 382 book getword nsData $date dbname -var DBNAME 426 383 book npages nsData -var Npages 427 384 … … 434 391 option $date 435 392 436 if (("$ns_STATE" != " QUEUESTACKS")&&("$ns_STATE" != "TOWARP")&&("$ns_STATE" != "FORCETOWARP")) break437 $run = nightly_science.pl --queue_stacks --date $date 438 add_standard_args $run393 if (("$ns_STATE" != "STACKING")&&("$ns_STATE" != "TOWARP")&&("$ns_STATE" != "FORCETOWARP")) break 394 $run = nightly_science.pl --queue_stacks --date $date --dbname $DBNAME 395 # add_standard_args $run 439 396 command $run 440 397 end … … 442 399 task.exit 0 443 400 # convert 'stdout' to book format 444 book delpage ns Data$options:0401 book delpage nsStacks $options:0 445 402 # We've queued up stacking. We're done with this date, so don't reload the page. 446 ipptool2book stdout ns Data-uniq -key date447 448 book getword ns Data$options:0 nsNmacros -var ns_Nmacros403 ipptool2book stdout nsStacks -uniq -key date 404 405 book getword nsStacks $options:0 nsNmacros -var ns_Nmacros 449 406 if ("$ns_Nmacros" != "NULL") 450 407 for i 0 $ns_Nmacros 451 408 sprintf macroName "ns%dMacro" $i 452 book getword ns Data$options:0 $macroName -var macroCmd409 book getword nsStacks $options:0 $macroName -var macroCmd 453 410 $macroCmd 454 411 end … … 477 434 # 478 435 task ns.stacks.confirm 436 active false 479 437 host local 480 438 periods -poll $LOADPOLL … … 488 446 489 447 book getpage nsData $ns_CstackPAGE -var date 490 book getword ns Data$date nsStackState -var ns_STATE491 book getword nsData $date dbname -var $DBNAME448 book getword nsStacks $date nsStackState -var ns_STATE 449 book getword nsData $date dbname -var DBNAME 492 450 book npages nsData -var Npages 493 451 … … 501 459 502 460 if ("$ns_STATE" != "STACKING") break 503 $run = nightly_science.pl --confirm_stacks --date $date 504 add_standard_args $run461 $run = nightly_science.pl --confirm_stacks --date $date --dbname $DBNAME 462 # add_standard_args $run 505 463 command $run 506 464 end … … 508 466 task.exit 0 509 467 # convert 'stdout' to book format 510 book delpage ns Data$options:0511 ipptool2book stdout ns Data-uniq -key date512 513 book getword ns Data$options:0 nsNmacros -var ns_Nmacros468 book delpage nsStacks $options:0 469 ipptool2book stdout nsStacks -uniq -key date 470 471 book getword nsStacks $options:0 nsNmacros -var ns_Nmacros 514 472 if ("$ns_Nmacros" != "NULL") 515 473 for i 0 $ns_Nmacros 516 474 sprintf macroName "ns%dMacro" $i 517 book getword ns Data$options:0 $macroName -var macroCmd475 book getword nsStacks $options:0 $macroName -var macroCmd 518 476 $macroCmd 519 477 end … … 543 501 # 544 502 task ns.diffs.load 503 active false 545 504 host local 546 505 periods -poll $LOADPOLL … … 554 513 555 514 book getpage nsData $ns_diffPAGE -var date 556 book getword nsData $date nsDiffState -var ns_STATE 557 book getword nsData $date dbname -var $DBNAME 515 book getword nsDiffs $date nsDiffState -var ns_STATE 516 book getword nsStacks $date nsStackState -var ns_stack_STATE 517 book getword nsData $date dbname -var DBNAME 558 518 book npages nsData -var Npages 559 519 … … 567 527 568 528 if ("$ns_STATE" != "TOWARP") break 569 $run = nightly_science.pl --check_diffs --date $date 570 add_standard_args $run529 $run = nightly_science.pl --check_diffs --date $date --dbname $DBNAME 530 # add_standard_args $run 571 531 command $run 572 532 end … … 575 535 task.exit 0 576 536 # convert 'stdout' to book format 577 book delpage nsD ata$options:0578 ipptool2book stdout nsD ata-uniq -key date579 580 book getword nsD ata$options:0 nsNmacros -var ns_Nmacros537 book delpage nsDiffs $options:0 538 ipptool2book stdout nsDiffs -uniq -key date 539 540 book getword nsDiffs $options:0 nsNmacros -var ns_Nmacros 581 541 if ("$ns_Nmacros" != "NULL") 582 542 for i 0 $ns_Nmacros 583 543 sprintf macroName "ns%dMacro" $i 584 book getword nsD ata$options:0 $macroName -var macroCmd544 book getword nsDiffs $options:0 $macroName -var macroCmd 585 545 $macroCmd 586 546 end … … 613 573 periods -poll $LOADPOLL 614 574 periods -exec $LOADEXEC 615 periods -timeout 120575 periods -timeout 900 616 576 npending 1 617 577 … … 621 581 622 582 book getpage nsData $ns_RdiffPAGE -var date 623 book getword nsData $date nsDiffState -var ns_STATE 624 book getword nsData $date dbname -var $DBNAME 583 book getword nsDiffs $date nsDiffState -var ns_STATE 584 book getword nsStacks $date nsStackState -var ns_stack_STATE 585 book getword nsData $date dbname -var DBNAME 625 586 book npages nsData -var Npages 626 587 … … 633 594 option $date 634 595 635 if (("$ns_STATE" != " QUEUEDIFFS")&&("$ns_STATE" != "TOWARP")&&("$ns_STATE" != "FORCETOWARP")) break636 $run = nightly_science.pl --queue_diffs --date $date 637 add_standard_args $run596 if (("$ns_STATE" != "DIFFING")&&("$ns_STATE" != "QUEUEDIFFS")&&("$ns_STATE" != "TOWARP")&&("$ns_STATE" != "FORCETOWARP")) break 597 $run = nightly_science.pl --queue_diffs --date $date --dbname $DBNAME 598 # add_standard_args $run 638 599 command $run 639 600 end … … 641 602 task.exit 0 642 603 # convert 'stdout' to book format 643 book delpage nsD ata$options:0604 book delpage nsDiffs $options:0 644 605 # We've queued up diffing. We're done with this date, so don't reload the page. 645 ipptool2book stdout nsD ata-uniq -key date646 647 book getword nsD ata$options:0 nsNmacros -var ns_Nmacros606 ipptool2book stdout nsDiffs -uniq -key date 607 608 book getword nsDiffs $options:0 nsNmacros -var ns_Nmacros 648 609 if ("$ns_Nmacros" != "NULL") 649 610 for i 0 $ns_Nmacros 650 611 sprintf macroName "ns%dMacro" $i 651 book getword nsD ata$options:0 $macroName -var macroCmd612 book getword nsDiffs $options:0 $macroName -var macroCmd 652 613 $macroCmd 653 614 end -
branches/eam_branches/ipp-20101205/ippTasks/pstamp.pro
r29719 r30446 258 258 book getword pstampRequest $pageName ds_outProduct -var PRODUCT 259 259 book getword pstampRequest $pageName outdir -var OUTDIR 260 book getword pstampRequest $pageName need_magic -var NEED_MAGIC 260 261 book getword pstampRequest $pageName label -var LABEL 261 262 … … 263 264 264 265 $run = pstamp_parser_run.pl --req_id $REQ_ID --uri $URI --product $PRODUCT --outdir $OUTDIR --label $LABEL --redirect-output 266 267 if ($NEED_MAGIC != 0) 268 $run = $run --need_magic 269 end 265 270 266 271 add_standard_args run -
branches/eam_branches/ipp-20101205/ippTasks/publish.pro
r30102 r30446 79 79 end 80 80 add_poll_args run 81 add_poll_labels run 81 82 command $run 82 83 end … … 131 132 book getword publishRun $pageName dbname -var DBNAME 132 133 book getword publishRun $pageName output_format -var OUTPUT_FORMAT 134 book getword publishRun $pageName need_magic -var NEED_MAGIC 133 135 134 136 stdout $LOGDIR/publish.run.log … … 139 141 140 142 $run = publish_file.pl --pub_id $PUB_ID --camera $CAMERA --workdir $WORKDIR --product $PRODUCT --stage $STAGE --stage_id $STAGE_ID --output_format $OUTPUT_FORMAT --redirect-output 143 144 if ("$NEED_MAGIC" == "T") 145 $run = $run --need-magic 146 end 147 141 148 add_standard_args run 142 149 -
branches/eam_branches/ipp-20101205/ippTasks/register.pro
r30102 r30446 9 9 book init regPendingExp 10 10 book init regPendingBurntoolImfile 11 book init regDates 11 12 12 13 macro register.reset … … 14 15 book init regPendingExp 15 16 book init regPendingBurntoolImfile 17 book init regDates 16 18 end 17 19 … … 21 23 book listbook regPendingExp 22 24 book listbook regPendingBurntoolImfile 25 book listbook regDates 23 26 end 24 27 … … 30 33 active true 31 34 end 35 task register.imfile.revert 36 active false 37 end 32 38 task register.exp.load 33 39 active true … … 51 57 active false 52 58 end 59 task register.imfile.revert 60 active false 61 end 53 62 task register.exp.load 54 63 active false … … 65 74 end 66 75 76 macro register.revert.on 77 task register.imfile.revert 78 active true 79 end 80 end 81 82 macro register.revert.off 83 task register.imfile.revert 84 active false 85 end 86 end 87 88 macro burntool.on 89 task register.burntool.load 90 active true 91 end 92 task register.burntool.run 93 active true 94 end 95 end 96 97 macro burntool.off 98 task register.burntool.load 99 active false 100 end 101 task register.burntool.run 102 active false 103 end 104 end 105 106 macro register.add.date 107 if ($0 != 2) 108 echo "USAGE: register.add.date (YYYY-MM-DD)" 109 break 110 end 111 112 book newpage regDates $1 113 book setword regDates $1 nsState NEW 114 book setword regDates $1 dbname $DB:0 115 end 116 117 67 118 $valid_burntool_value = 14 119 $sunrise = 17:30:00 120 $sunset = 03:30:00 68 121 69 122 macro replace.survey.values … … 147 200 $regPendingImfile_DB = 0 148 201 $regPendingBurntoolImfile_DB = 0 202 $regRevertImfile_DB = 0 149 203 $regPendingExp_DB = 0 150 204 … … 265 319 # XXX register_imfile.pl differs from the standard script : it does not have an 'outroot' argument, and it does not take '--redirect' 266 320 $run = register_imfile.pl --exp_id $EXP_ID --tmp_class_id $TMP_CLASS_ID --tmp_exp_name $TMP_EXP_NAME --uri $URI --logfile $logfile --bytes $BYTES --md5sum $MD5SUM 321 $run = $run --sunset $sunset --sunrise $sunrise 267 322 add_standard_args run 268 323 … … 295 350 end 296 351 end 352 353 task register.imfile.revert 354 host local 355 periods -poll 60.0 356 periods -exec 1800.0 357 periods -timeout 120.0 358 npending 1 359 360 stdout NULL 361 stderr $LOGDIR/register.imfile.revert.log 362 363 task.exec 364 $run = regtool -revertprocessedimfile 365 if ($DB:n == 0) 366 option DEFAULT 367 else 368 option $DB:$regRevertImfile_DB 369 $run = $run -dbname $DB:$regRevertImfile_DB 370 $regRevertImfile_DB ++ 371 if ($regRevertImfile_DB >= $DB:n) set regRevertImfile_DB = 0 372 end 373 add_poll_args run 374 command $run 375 end 376 377 # success 378 task.exit 0 379 end 380 381 # locked list 382 task.exit default 383 showcommand failure 384 end 385 386 task.exit crash 387 showcommand crash 388 end 389 390 # operation times out 391 task.exit timeout 392 showcommand timeout 393 end 394 end 395 297 396 298 397 # select exposures ready for register_exp.pl … … 463 562 # select entried from the current DB; cycle to the next DB, if it exists 464 563 task.exec 564 book npages regDates -var Npages 565 if ($Npages == 0) 566 $today = `date -u +%Y-%m-%d` 567 else 568 book getpage regDates $reg_datePAGE -var today 569 $reg_datePAGE ++ 570 if ($reg_datePAGE >= $Npages) set reg_datePAGE = 0 571 end 572 465 573 $run = regtool -pendingburntoolimfile 466 $today = `date -u +%Y-%m-%d` 574 467 575 # debugging purposes 468 # $today = "2010-12-06" 469 $run = $run -date $today -valid_burntool $valid_burntool_value 576 # $today = "2010-12-25" 577 $dateobs_begin = $today\T$sunset 578 $dateobs_end = $today\T$sunrise 579 $run = $run -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end -valid_burntool $valid_burntool_value 470 580 if ($DB:n == 0) 471 581 option DEFAULT … … 574 684 end 575 685 576 686 task register.initday.load 687 host local 688 periods -poll $LOADPOLL 689 periods -exec $LOADEXEC 690 periods -timeout 30 691 trange 0:00:00 1:00:00 -nmax 1 692 npending 1 693 694 task.exec 695 $today = `date -u +%Y-%m-%d` 696 book newpage regDates $today 697 book setword regDates $today nsState NEW 698 book setword regDates $today dbname $DB:0 699 700 command true 701 end 702 703 task.exit 0 704 # nothing to do here? 705 end 706 # locked list 707 task.exit default 708 showcommand failure 709 end 710 task.exit crash 711 showcommand crash 712 end 713 #operation times out? 714 task.exit timeout 715 showcommand timeout 716 end 717 end 718 577 719 578 720 -
branches/eam_branches/ipp-20101205/ippTasks/survey.pro
r29768 r30446 259 259 # user functions to manipulate destreak labels 260 260 macro survey.add.destreak 261 if ($0 != 3)262 echo "USAGE: survey.add.destreak (label) (workdir base) "261 if ($0 != 4) 262 echo "USAGE: survey.add.destreak (label) (workdir base) (recovery root)" 263 263 break 264 264 end 265 265 book newpage SURVEY_DESTREAK $1 266 266 book setword SURVEY_DESTREAK $1 WORKDIR $2 267 book setword SURVEY_DESTREAK $1 RECOVERYROOT $3 267 268 book setword SURVEY_DESTREAK $1 STATE PENDING 268 269 end … … 366 367 # user functions to manipulate publish labels 367 368 macro survey.add.publish 368 if ($0 != 3)369 echo "USAGE: survey.add.publish ( label) (client_id)"369 if ($0 != 5) 370 echo "USAGE: survey.add.publish (tag) (label) (client_id) (comment)" 370 371 break 371 372 end 372 373 book newpage SURVEY_PUBLISH $1 373 book setword SURVEY_PUBLISH $1 CLIENT_ID $2 374 book setword SURVEY_PUBLISH $1 LABEL $2 375 book setword SURVEY_PUBLISH $1 CLIENT_ID $3 376 book setword SURVEY_PUBLISH $1 COMMENT $4 374 377 book setword SURVEY_PUBLISH $1 STATE PENDING 375 378 end … … 821 824 book setword SURVEY_DESTREAK $label STATE DONE 822 825 book getword SURVEY_DESTREAK $label WORKDIR -var workdir 826 book getword SURVEY_DESTREAK $label RECOVERYROOT -var recoveryroot 823 827 824 828 $run = magic_destreak_defineruns.pl --label $label --workdir $workdir/$label 829 if ("$recoveryroot" != "NULL") 830 $run = $run --recoveryroot $recoveryroot/$label 831 end 825 832 826 833 if ($DB:n == 0) … … 1084 1091 endif 1085 1092 1086 book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW 1087 if ("$label" == "NULL") 1088 # All labels have been done --- reset 1089 # echo "Resetting labels" 1093 # survey.publish allows multiple entries per label. 1094 # The key is called tag and must be unique 1095 book getpage SURVEY_PUBLISH 0 -var tag -key STATE NEW 1096 if ("$tag" == "NULL") 1097 # All tags have been done --- reset 1098 # echo "Resetting tags" 1090 1099 for i 0 $N 1091 book getpage SURVEY_PUBLISH $i -var label1092 book setword SURVEY_PUBLISH $ labelSTATE NEW1100 book getpage SURVEY_PUBLISH $i -var tag 1101 book setword SURVEY_PUBLISH $tag STATE NEW 1093 1102 end 1094 book getpage SURVEY_PUBLISH 0 -var label-key STATE NEW1103 book getpage SURVEY_PUBLISH 0 -var tag -key STATE NEW 1095 1104 1096 1105 # Select different database … … 1099 1108 end 1100 1109 1101 book setword SURVEY_PUBLISH $label STATE DONE 1102 book getword SURVEY_PUBLISH $label CLIENT_ID -var client_id 1110 book setword SURVEY_PUBLISH $tag STATE DONE 1111 book getword SURVEY_PUBLISH $tag LABEL -var label 1112 book getword SURVEY_PUBLISH $tag CLIENT_ID -var client_id 1113 book getword SURVEY_PUBLISH $tag COMMENT -var comment 1103 1114 1104 1115 $run = pubtool -definerun -label $label -client_id $client_id 1116 1117 if ("$comment" != "NULL") 1118 $run = $run -comment $comment 1119 end 1105 1120 1106 1121 if ($DB:n == 0) … … 1111 1126 end 1112 1127 1113 #echo $run 1128 echo $run 1129 1114 1130 command $run 1131 1115 1132 end 1116 1133 -
branches/eam_branches/ipp-20101205/ippTools/share/Makefile.am
r30102 r30446 246 246 magictool_exposure.sql \ 247 247 magictool_setfull.sql \ 248 magictool_setgotocleaned.sql \ 249 magictool_tocleanup.sql \ 248 250 magicdstool_clearstatefaults.sql \ 249 251 magicdstool_change_file_data_state.sql \ … … 333 335 regtool_updatebyqueryimfile.sql \ 334 336 regtool_pendingburntoolimfile.sql \ 337 regtool_checkstatus.sql \ 335 338 stacktool_associationdefine_select.sql \ 336 339 stacktool_definebyquery_insert.sql \ -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_SSdiff.sql
r27027 r30446 17 17 diffSkyfile.quality, 18 18 distRun.no_magic, 19 0 AS magicked 19 0 AS magicked, 20 IFNULL(Label.priority, 10000) AS priority 20 21 FROM distRun 21 22 JOIN distTarget USING(target_id, stage, clean) … … 42 43 ON distRun.dist_id = distComponent.dist_id 43 44 AND diffSkyfile.skycell_id = distComponent.component 45 LEFT JOIN Label ON distRun.label = Label.label 44 46 WHERE 45 47 distRun.state = 'new' … … 48 50 AND ((diffRun.magicked > 0) OR distRun.no_magic) 49 51 AND (diffRun.state = 'full' OR (distRun.clean AND diffRun.state = 'cleaned')) 52 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_camera.sql
r29509 r30446 15 15 camProcessedExp.quality, 16 16 distRun.no_magic, 17 chipRun.magicked 17 chipRun.magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 21 22 JOIN camProcessedExp USING(cam_id) 22 23 JOIN chipRun USING(chip_id) 23 -- JOIN chipProcessedImfile USING(exp_id, chip_id)24 24 JOIN rawExp using(exp_id) 25 25 LEFT JOIN distComponent 26 26 ON distRun.dist_id = distComponent.dist_id 27 -- AND chipProcessedImfile.class_id = distComponent.component 27 LEFT JOIN Label 28 ON distRun.label = Label.label 28 29 WHERE 29 30 distRun.state = 'new' 30 31 AND distRun.stage = 'camera' 31 32 AND distComponent.dist_id IS NULL 32 AND (((clean OR (chipRun.magicked >0)) AND (camRun.magicked > 0)) OR distRun.no_magic)33 AND (((clean OR (chipRun.magicked != 0)) AND (camRun.magicked > 0)) OR distRun.no_magic) 33 34 AND (camRun.state = 'full' OR (distRun.clean AND camRun.state = 'cleaned')) 35 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_chip.sql
r26567 r30446 15 15 chipProcessedImfile.quality, 16 16 distRun.no_magic, 17 chipProcessedImfile.magicked 17 chipProcessedImfile.magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 24 25 ON distRun.dist_id = distComponent.dist_id 25 26 AND chipProcessedImfile.class_id = distComponent.component 27 LEFT JOIN Label 28 ON distRun.label = Label.label 26 29 WHERE 27 30 distRun.state = 'new' … … 30 33 AND ((chipRun.magicked > 0) OR distRun.no_magic) 31 34 AND (chipRun.state = 'full' OR (distRun.clean AND chipRun.state = 'cleaned')) 35 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_chip_bg.sql
r28730 r30446 15 15 0 AS quality, 16 16 distRun.no_magic, 17 chipBackgroundImfile.magicked 17 chipBackgroundImfile.magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 25 26 ON distRun.dist_id = distComponent.dist_id 26 27 AND chipBackgroundImfile.class_id = distComponent.component 28 LEFT JOIN Label ON distRun.label = Label.label 27 29 WHERE 28 30 distRun.state = 'new' … … 31 33 AND ((chipBackgroundRun.magicked > 0) OR distRun.no_magic) 32 34 AND (chipBackgroundRun.state = 'full') 35 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_diff.sql
r26567 r30446 17 17 diffSkyfile.quality, 18 18 distRun.no_magic, 19 diffSkyfile.magicked 19 diffSkyfile.magicked, 20 IFNULL(Label.priority, 10000) AS priority 20 21 FROM distRun 21 22 JOIN distTarget USING(target_id, stage, clean) … … 32 33 ON distRun.dist_id = distComponent.dist_id 33 34 AND diffSkyfile.skycell_id = distComponent.component 35 LEFT JOIN Label ON distRun.label = Label.label 34 36 WHERE 35 37 distRun.state = 'new' … … 38 40 AND ((diffRun.magicked > 0) OR distRun.no_magic) 39 41 AND (diffRun.state = 'full' OR (distRun.clean AND diffRun.state = 'cleaned')) 42 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_fake.sql
r27458 r30446 15 15 0 as quality, 16 16 distRun.no_magic, 17 0 as magicked 17 0 as magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 26 27 ON distRun.dist_id = distComponent.dist_id 27 28 AND fakeProcessedImfile.class_id = distComponent.component 29 LEFT JOIN Label ON distRun.label = Label.label 28 30 WHERE 29 31 distRun.state = 'new' 30 32 AND distRun.stage = 'fake' 31 33 AND distComponent.dist_id IS NULL 34 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_raw.sql
r27457 r30446 17 17 0 as quality, 18 18 distRun.no_magic, 19 rawImfile.magicked 19 rawImfile.magicked, 20 IFNULL(Label.priority, 10000) AS priority 20 21 FROM distRun 21 22 JOIN distTarget USING(target_id, stage, clean) … … 28 29 ON distRun.dist_id = distComponent.dist_id 29 30 AND rawImfile.class_id = distComponent.component 31 LEFT JOIN Label ON distRun.label = Label.label 30 32 WHERE 31 33 distRun.state = 'new' … … 34 36 AND distComponent.dist_id IS NULL 35 37 AND (rawExp.magicked OR distRun.no_magic) 38 AND (Label.active OR Label.active IS NULL) 36 39 UNION 37 40 -- raw stage alternate inputs … … 54 57 0 as quality, 55 58 distRun.no_magic, 56 rawImfile.magicked 59 rawImfile.magicked, 60 IFNULL(Label.priority, 10000) AS priority 57 61 FROM distRun 58 62 JOIN distTarget USING(target_id, stage, clean) … … 68 72 ON distRun.dist_id = distComponent.dist_id 69 73 AND rawImfile.class_id = distComponent.component 74 LEFT JOIN Label ON distRun.label = Label.label 70 75 WHERE 71 76 distRun.state = 'new' … … 74 79 AND chipProcessedImfile.data_state = 'full' 75 80 AND chipProcessedImfile.magicked > 0 81 AND (Label.active OR Label.active IS NULL) 76 82 UNION 77 83 -- raw stage clean (dbinfo only) … … 93 99 0 as quality, 94 100 distRun.no_magic, 95 rawExp.magicked 101 rawExp.magicked, 102 IFNULL(Label.priority, 10000) AS priority 96 103 FROM distRun 97 104 JOIN distTarget USING(target_id, stage, clean) … … 99 106 LEFT JOIN distComponent 100 107 ON distRun.dist_id = distComponent.dist_id 108 LEFT JOIN Label ON distRun.label = Label.label 101 109 WHERE 102 110 distRun.state = 'new' … … 104 112 AND distRun.clean 105 113 AND distComponent.dist_id IS NULL 114 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_sky.sql
r28959 r30446 15 15 staticskyResult.quality, 16 16 1 AS no_magic, 17 0 AS magicked 17 0 AS magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 43 44 ON distRun.dist_id = distComponent.dist_id 44 45 AND stackRun.skycell_id = distComponent.component 46 LEFT JOIN Label ON distRun.label = Label.label 45 47 WHERE 46 48 distRun.state = 'new' … … 49 51 AND (staticskyRun.state = 'full' OR (distRun.clean AND staticskyRun.state = 'cleaned')) 50 52 AND (staticskyResult.fault = 0 AND staticskyResult.quality = 0) 53 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_stack.sql
r25838 r30446 17 17 stackSumSkyfile.quality, 18 18 1 AS no_magic, 19 0 AS magicked 19 0 AS magicked, 20 IFNULL(Label.priority, 10000) AS priority 20 21 FROM distRun 21 22 JOIN distTarget USING(target_id, stage, clean) … … 43 44 ON distRun.dist_id = distComponent.dist_id 44 45 AND stackRun.skycell_id = distComponent.component 46 LEFT JOIN Label ON distRun.label = Label.label 45 47 WHERE 46 48 distRun.state = 'new' … … 49 51 AND (stackRun.state = 'full' OR (distRun.clean AND stackRun.state = 'cleaned')) 50 52 AND (stackSumSkyfile.fault = 0 AND stackSumSkyfile.quality = 0) 53 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_warp.sql
r26567 r30446 15 15 warpSkyfile.quality, 16 16 distRun.no_magic, 17 warpSkyfile.magicked 17 warpSkyfile.magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 27 28 ON distRun.dist_id = distComponent.dist_id 28 29 AND warpSkyfile.skycell_id = distComponent.component 30 LEFT JOIN Label ON distRun.label = Label.label 29 31 WHERE 30 32 distRun.state = 'new' … … 33 35 AND ((warpRun.magicked > 0) OR distRun.no_magic) 34 36 AND (warpRun.state = 'full' OR (distRun.clean AND warpRun.state = 'cleaned')) 37 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_pending_warp_bg.sql
r28742 r30446 15 15 0 as quality, 16 16 distRun.no_magic, 17 warpBackgroundSkyfile.magicked 17 warpBackgroundSkyfile.magicked, 18 IFNULL(Label.priority, 10000) AS priority 18 19 FROM distRun 19 20 JOIN distTarget USING(target_id, stage, clean) … … 28 29 ON distRun.dist_id = distComponent.dist_id 29 30 AND warpBackgroundSkyfile.skycell_id = distComponent.component 31 LEFT JOIN Label ON distRun.label = Label.label 30 32 WHERE 31 33 distRun.state = 'new' … … 34 36 AND ((warpBackgroundRun.magicked > 0) OR distRun.no_magic) 35 37 AND (warpBackgroundRun.state = 'full') 38 AND (Label.active OR Label.active IS NULL) -
branches/eam_branches/ipp-20101205/ippTools/share/disttool_revertrun.sql
r26266 r30446 1 1 UPDATE distRun 2 2 SET distRun.fault = 0 3 WHERE distRun.state = 'new'3 WHERE (distRun.state = 'new' OR distRun.state = 'goto_cleaned') 4 4 AND distRun.fault != 0 -
branches/eam_branches/ipp-20101205/ippTools/share/magicdstool_todestreak_camera.sql
r29561 r30446 38 38 AND magicDSRun.stage = 'camera' 39 39 AND camRun.state = 'full' 40 AND chipRun.state = 'full'41 AND chipRun.magicked40 AND ((chipRun.state = 'full' AND chipRun.magicked > 0) 41 OR (chipRun.state = 'cleaned' AND chipRun.magicked < 0)) 42 42 AND camProcessedExp.fault = 0 43 43 AND camProcessedExp.quality = 0 -
branches/eam_branches/ipp-20101205/ippTools/share/magicdstool_torevert_diff.sql
r27945 r30446 10 10 outroot, 11 11 diffSkyfile.path_base, 12 magicDSFile.backup_path_base, 13 magicDSFile.recovery_path_base, 12 14 "NULL" AS cam_path_base, 13 15 CAST(diffRun.bothways AS SIGNED) AS bothways, -
branches/eam_branches/ipp-20101205/ippTools/share/pstamptool_pendingreq.sql
r27874 r30446 3 3 pstampRequest.*, 4 4 pstampDataStore.outProduct AS ds_outProduct, 5 IFNULL(pstampDataStore.need_magic, 1) AS need_magic, 5 6 IFNULL(Label.priority, 10000) AS priority 6 7 FROM pstampRequest -
branches/eam_branches/ipp-20101205/ippTools/share/pubtool_pending.sql
r30102 r30446 10 10 publishClient.workdir, 11 11 publishClient.output_format, 12 publishClient.magicked AS need_magic, 12 13 diffRun.diff_id AS stage_id, 13 14 rawExp.camera, … … 37 38 publishClient.workdir, 38 39 publishClient.output_format, 40 publishClient.magicked AS need_magic, 39 41 camRun.cam_id AS stage_id, 40 42 rawExp.camera, … … 59 61 publishClient.workdir, 60 62 publishClient.output_format, 63 publishClient.magicked AS need_magic, 61 64 diffPhotRun.diff_phot_id AS stage_id, 62 65 rawExp.camera, -
branches/eam_branches/ipp-20101205/ippTools/share/pxadmin_create_tables.sql
r30102 r30446 1391 1391 uri VARCHAR(255), 1392 1392 pollInterval INTEGER DEFAULT 60, 1393 need_magic TINYINT, 1393 1394 PRIMARY KEY(ds_id), 1394 1395 KEY(ds_id) -
branches/eam_branches/ipp-20101205/ippTools/share/regtool_checkburntoolimfile.sql
r30102 r30446 1 1 SELECT DISTINCT 2 exp_name,2 summitExp.exp_name, 3 3 rawImfile.uri, 4 4 summitExp.dateobs AS registered, … … 11 11 newExp.exp_id, 12 12 summitExp.exp_type, 13 raw Exp.dateobs,14 raw Exp.obs_mode AS obs_mode,15 raw Exp.object AS object,13 rawImfile.dateobs, 14 rawImfile.obs_mode AS obs_mode, 15 rawImfile.object AS object, 16 16 rawImfile.burntool_state AS burntool_state, 17 17 rawImfile.class_id, 18 summitImfile.class_id AS summit_class_id, 18 19 (pzDownloadExp.state = 'stop') AS is_downloaded, 19 20 (rawImfile.burntool_state IS NOT NULL) AS is_registered 20 21 FROM 21 summitExp 22 LEFT JOIN pzDownloadExp USING(exp_name) 23 LEFT JOIN newExp ON exp_name = tmp_exp_name 24 LEFT JOIN rawExp USING(exp_id, exp_name) 25 LEFT JOIN rawImfile USING(exp_name) 22 summitExp 23 JOIN summitImfile USING(exp_name) 24 LEFT JOIN pzDownloadExp USING(exp_name) 25 LEFT JOIN newExp ON summitExp.exp_name = tmp_exp_name 26 LEFT JOIN newImfile ON (summitImfile.class_id = newImfile.tmp_class_id AND newExp.exp_id = newImfile.exp_id) 27 LEFT JOIN rawExp ON rawExp.exp_id = newExp.exp_id 28 LEFT JOIN rawImfile ON (rawImfile.exp_id = newExp.exp_id AND rawImfile.tmp_class_id = newImfile.tmp_class_id) 26 29 WHERE 27 summitExp.dateobs >= '@DATE @T00:00:00'28 AND summitExp.dateobs <= '@DATE @T23:59:59'29 AND (rawImfile.class_id = '@CLASS_ID@' OR rawImfile.class_id IS NULL)30 AND ( exp_name <= '@EXP_NAME@')30 summitExp.dateobs >= '@DATEOBS_BEGIN@' 31 AND summitExp.dateobs <= '@DATEOBS_END@' 32 AND summitImfile.class_id = '@CLASS_ID@' 33 AND (summitExp.exp_name <= '@EXP_NAME@') 31 34 ORDER BY summitExp.dateobs -
branches/eam_branches/ipp-20101205/ippTools/share/regtool_pendingburntoolimfile.sql
r30102 r30446 12 12 newImfile.tmp_class_id, 13 13 summitExp.exp_type, 14 raw Exp.dateobs,15 raw Exp.obs_mode AS obs_mode,16 raw Exp.object AS object,14 rawImfile.dateobs, 15 rawImfile.obs_mode AS obs_mode, 16 rawImfile.object AS object, 17 17 rawImfile.burntool_state AS burntool_state, 18 18 rawImfile.class_id, 19 summitImfile.class_id AS summit_class_id, 19 20 (pzDownloadExp.state = 'stop') AS is_downloaded, 20 21 (rawImfile.burntool_state IS NOT NULL) AS is_registered 21 22 FROM 22 summitExp 23 LEFT JOIN pzDownloadExp USING(exp_name) 24 LEFT JOIN newExp ON exp_name = tmp_exp_name 25 LEFT JOIN newImfile USING(exp_id) 26 LEFT JOIN rawExp USING(exp_id, exp_name) 27 LEFT JOIN rawImfile ON (rawImfile.exp_name = newExp.tmp_exp_name AND rawImfile.tmp_class_id = newImfile.tmp_class_id) 23 summitExp 24 JOIN summitImfile USING(exp_name) 25 LEFT JOIN pzDownloadExp USING(exp_name) 26 LEFT JOIN newExp ON summitExp.exp_name = tmp_exp_name 27 LEFT JOIN newImfile ON (summitImfile.class_id = newImfile.tmp_class_id AND newExp.exp_id = newImfile.exp_id) 28 LEFT JOIN rawExp ON rawExp.exp_id = newExp.exp_id 29 LEFT JOIN rawImfile ON (rawImfile.exp_id = newExp.exp_id AND rawImfile.tmp_class_id = newImfile.tmp_class_id) 28 30 WHERE 29 summitExp.dateobs >= '@DATE @T00:00:00'30 AND summitExp.dateobs <= '@DATE@T23:59:59'31 ORDER BY newImfile.tmp_class_id,summitExp.dateobs31 summitExp.dateobs >= '@DATEOBS_BEGIN@' 32 AND summitExp.dateobs <= '@DATEOBS_END@' 33 ORDER BY summitImfile.class_id,summitExp.dateobs -
branches/eam_branches/ipp-20101205/ippTools/src/disttool.c
r29067 r30446 857 857 psFree(where); 858 858 859 psStringAppend(&query, "\nORDER BY priority DESC, dist_id"); 860 859 861 // treat limit == 0 as "no limit" 860 862 if (limit) { -
branches/eam_branches/ipp-20101205/ippTools/src/magicdstool.c
r30102 r30446 1115 1115 psString queryFile = NULL; 1116 1116 if (state) { 1117 if (! strcmp(state, "new") ) {1117 if (! strcmp(state, "new") || !strcmp(state, "goto_restored")) { 1118 1118 queryFile = "magicdstool_revertdestreakedfile.sql"; 1119 1119 } else if (!strcmp(state, "update")) { … … 1724 1724 PXOPT_LOOKUP_STR(component, config->args, "-component", false, false); 1725 1725 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 1726 PXOPT_LOOKUP_STR(recoveryroot, config->args, "-set_recoveryroot", false, false); 1726 1727 1727 1728 psString query = pxDataGet("magicdstool_setfiletoupdate.sql"); … … 1734 1735 if (label) { 1735 1736 psStringAppend(&setHook, "\n , magicDSRun.label = '%s'", label); 1737 } 1738 if (recoveryroot) { 1739 psStringAppend(&setHook, "\n , magicDSRun.recoveryroot = '%s'", recoveryroot); 1736 1740 } 1737 1741 -
branches/eam_branches/ipp-20101205/ippTools/src/magicdstoolConfig.c
r30102 r30446 230 230 psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-component", 0, "define component", NULL); 231 231 psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-set_label", 0, "set new label", NULL); 232 psMetadataAddStr(setfiletoupdateArgs, PS_LIST_TAIL, "-set_recoveryroot", 0, "define new recovery directory", NULL); 232 233 233 234 // -destreakedfile -
branches/eam_branches/ipp-20101205/ippTools/src/magictool.c
- Property svn:mergeinfo set to
r29625 r30446 49 49 static bool censorrunMode(pxConfig *config); 50 50 static bool exposureMode(pxConfig *config); 51 static bool setgotocleanedMode(pxConfig *config); 52 static bool tocleanupMode(pxConfig *config); 53 static bool setworkdirstateMode(pxConfig *config); 51 54 52 55 static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state, psString setString); … … 89 92 MODECASE(MAGICTOOL_MODE_CENSORRUN, censorrunMode); 90 93 MODECASE(MAGICTOOL_MODE_EXPOSURE, exposureMode); 94 MODECASE(MAGICTOOL_MODE_SETGOTOCLEANED, setgotocleanedMode); 95 MODECASE(MAGICTOOL_MODE_TOCLEANUP, tocleanupMode); 96 MODECASE(MAGICTOOL_MODE_SETWORKDIRSTATE, setworkdirstateMode); 91 97 default: 92 98 psAbort("invalid option (this should not happen)"); … … 829 835 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 830 836 831 // look for "inputs" that need to processed832 psString query = pxDataGet("magictool_toprocess_inputs.sql");833 if (!query) {834 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");835 return false;836 }837 838 837 psString whereString = NULL; 839 838 if (psListLength(where->list)) { … … 844 843 psFree(where); 845 844 846 psStringAppend(&query, "\nORDER BY priority DESC, magic_id"); 847 848 // treat limit == 0 as "no limit" 849 if (limit) { 850 // cut limit in half 851 // hack to prevent pending leaf nodes from blocking branch nodes 852 psString limitString = psDBGenerateLimitSQL((limit + 1) / 2); 853 psStringAppend(&query, " %s", limitString); 854 psFree(limitString); 855 } 856 857 if (!p_psDBRunQueryF(config->dbh, query, whereString, whereString)) { 858 psError(PS_ERR_UNKNOWN, false, "database error"); 859 psFree(whereString); 860 psFree(query); 861 return false; 862 } 863 psFree(query); 864 865 psArray *output = p_psDBFetchResult(config->dbh); 866 if (!output) { 867 psErrorCode err = psErrorCodeLast(); 868 switch (err) { 869 case PS_ERR_DB_CLIENT: 870 psError(PXTOOLS_ERR_SYS, false, "database error"); 871 case PS_ERR_DB_SERVER: 872 psError(PXTOOLS_ERR_PROG, false, "database error"); 873 default: 874 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 875 } 876 877 return false; 878 } 879 if (!psArrayLength(output)) { 880 psTrace("magictool", PS_LOG_INFO, "no rows found"); 881 } 882 883 if (limit) { 884 if (psArrayLength(output) >= limit) { 885 // we've found enough (note that limit was applied to the query so '> limit' won't happen) 886 // negative simple so the default is true 887 if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) { 888 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 889 psFree(output); 890 return false; 891 } 892 psFree(output); 893 return true; 894 } 895 } 896 897 // look for tree nodes that need to be processed 845 // First look for branch nodes that need to be processed. 846 // These get priority over skycells because they are from runs 847 // that are already in progress and there are fewer of them. 848 // When we looked for skycells first we got starved. 898 849 899 850 // first find incomplete magicRuns 900 query = pxDataGet("magictool_toprocess_runs.sql");851 psString query = pxDataGet("magictool_toprocess_runs.sql"); 901 852 if (!query) { 902 853 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 904 855 } 905 856 906 // we limit the query even though it is cheap (only magic_id is selected) 907 908 // XXX: if the first 1000 unfinished magicRuns have no ready nodes 909 // that haven't faulted, later runs won't get returned even though 910 // they have work to do. When we used a limit of 100 we actually ran 911 // into this problem. Since we're using labels a limit of 1000 will 912 // probably be ok. 857 // Find outstanding magicRuns in new state. 858 // We limit the query, but this is problematic. In practice do 859 // we need to? 860 // XXX: If the first 1000 magicRuns have no branch nodes ready 861 // but higher runs do we they won't be noticed. 862 // Perhaps have this limit be an argument. 913 863 { 914 864 psString limitString = psDBGenerateLimitSQL( 1000 ); … … 940 890 return false; 941 891 } 892 942 893 if (!psArrayLength(magicRuns)) { 894 // no pending magicRuns nothing to do 943 895 psTrace("magictool", PS_LOG_INFO, "no rows found"); 944 psFree(magicRuns);945 896 return true; 946 897 } 947 948 query = pxDataGet("magictool_toprocess_tree.sql"); 898 psArray *output = psArrayAllocEmpty(100); 899 900 { 901 query = pxDataGet("magictool_toprocess_tree.sql"); 902 if (!query) { 903 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 904 return false; 905 } 906 907 for (psS64 index = 0; index < psArrayLength(magicRuns); index++) { 908 if (limit && (psArrayLength(output) >= limit)) { 909 break; 910 } 911 bool status; 912 psS64 magic_id = psMetadataLookupS64(&status, magicRuns->data[index], "magic_id"); 913 if (!status) { 914 psAbort("failed to lookup value for magic_id column"); 915 } 916 917 whereString = NULL; 918 psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id); 919 if (!p_psDBRunQueryF(config->dbh, query, whereString )) { 920 psError(PS_ERR_UNKNOWN, false, "database error"); 921 psFree(whereString); 922 psFree(query); 923 return false; 924 } 925 psFree(whereString); 926 psArray *magicTree = p_psDBFetchResult(config->dbh); 927 if (!magicTree) { 928 psErrorCode err = psErrorCodeLast(); 929 switch (err) { 930 case PS_ERR_DB_CLIENT: 931 psError(PXTOOLS_ERR_SYS, false, "database error"); 932 case PS_ERR_DB_SERVER: 933 psError(PXTOOLS_ERR_PROG, false, "database error"); 934 default: 935 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 936 } 937 938 return false; 939 } 940 psS64 length = psArrayLength(magicTree); 941 if (!length) { 942 psTrace("magictool", PS_LOG_INFO, "no rows found for magic_id %" PRId64, magic_id); 943 psFree(magicTree); 944 continue; 945 } 946 947 psHash *forest = psHashAlloc(length); 948 949 // convert the array of metadata into a pxTree structure 950 for (long i = 0; i < length; i++) { 951 bool status; 952 psString node = psMetadataLookupStr(&status, magicTree->data[i], "node"); 953 if (!status) { 954 psAbort("failed to lookup value for node column"); 955 } 956 957 psString dep = psMetadataLookupStr(&status, magicTree->data[i], "dep"); 958 if (!status) { 959 psAbort("failed to lookup value for dep column"); 960 } 961 962 pxTreeBuilder(forest, node, dep, magicTree->data[i]); 963 964 } 965 966 // find the root of the tree 967 pxNode *root = psMemIncrRefCounter(psHashLookup(forest, "root")); 968 psFree(forest); 969 // pxTreePrint(stdout, root); 970 971 // crawl through the tree and looking for nodes with children that are all 972 // "done" 973 pxTreeCrawl(root, findReadyNodes, output); 974 psFree(root); 975 psFree(magicTree); 976 } 977 978 int len = psArrayLength(output); 979 if (len) { 980 if (limit) { 981 if (limit < psArrayLength(output)) { 982 // truncate the array 983 long arrayLength = psArrayLength(output); 984 for (long i = arrayLength - 1; i >= limit; i--) { 985 psArrayRemoveIndex(output, i); 986 } 987 // negative simple so the default is true 988 if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) { 989 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 990 psFree(output); 991 return false; 992 } 993 psFree(output); 994 return true; 995 } else { 996 limit -= len; 997 } 998 } 999 } 1000 } 1001 1002 // look for "inputs" (skycells) that need to processed 1003 query = pxDataGet("magictool_toprocess_inputs.sql"); 949 1004 if (!query) { 950 1005 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 952 1007 } 953 1008 954 for (psS64 index = 0; index < psArrayLength(magicRuns); index++) { 955 if (limit && (psArrayLength(output) >= limit)) { 956 break; 957 } 958 bool status; 959 psS64 magic_id = psMetadataLookupS64(&status, magicRuns->data[index], "magic_id"); 960 if (!status) { 961 psAbort("failed to lookup value for magic_id column"); 962 } 963 964 whereString = NULL; 965 psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id); 966 if (!p_psDBRunQueryF(config->dbh, query, whereString )) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 968 psFree(whereString); 969 psFree(query); 970 return false; 971 } 1009 psStringAppend(&query, "\nORDER BY priority DESC, magic_id"); 1010 1011 // treat limit == 0 as "no limit" 1012 if (limit) { 1013 psString limitString = psDBGenerateLimitSQL(limit); 1014 psStringAppend(&query, " %s", limitString); 1015 psFree(limitString); 1016 } 1017 1018 if (!p_psDBRunQueryF(config->dbh, query, whereString, whereString)) { 1019 psError(PS_ERR_UNKNOWN, false, "database error"); 972 1020 psFree(whereString); 973 psArray *magicTree = p_psDBFetchResult(config->dbh); 974 if (!magicTree) { 975 psErrorCode err = psErrorCodeLast(); 976 switch (err) { 977 case PS_ERR_DB_CLIENT: 978 psError(PXTOOLS_ERR_SYS, false, "database error"); 979 case PS_ERR_DB_SERVER: 980 psError(PXTOOLS_ERR_PROG, false, "database error"); 981 default: 982 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 983 } 984 985 return false; 986 } 987 psS64 length = psArrayLength(magicTree); 988 if (!length) { 989 psTrace("magictool", PS_LOG_INFO, "no rows found for magic_id %" PRId64, magic_id); 990 psFree(magicTree); 991 continue; 992 } 993 994 psHash *forest = psHashAlloc(length); 995 996 // convert the array of metadata into a pxTree structure 997 for (long i = 0; i < length; i++) { 998 bool status; 999 psString node = psMetadataLookupStr(&status, magicTree->data[i], "node"); 1000 if (!status) { 1001 psAbort("failed to lookup value for node column"); 1002 } 1003 1004 psString dep = psMetadataLookupStr(&status, magicTree->data[i], "dep"); 1005 if (!status) { 1006 psAbort("failed to lookup value for dep column"); 1007 } 1008 1009 pxTreeBuilder(forest, node, dep, magicTree->data[i]); 1010 1011 } 1012 1013 // find the root of the tree 1014 pxNode *root = psMemIncrRefCounter(psHashLookup(forest, "root")); 1015 psFree(forest); 1016 // pxTreePrint(stdout, root); 1017 1018 // crawl through the tree and looking for nodes with children that are all 1019 // "done" 1020 pxTreeCrawl(root, findReadyNodes, output); 1021 psFree(root); 1022 psFree(magicTree); 1023 } 1024 1021 psFree(query); 1022 return false; 1023 } 1024 psFree(query); 1025 1026 psArray *skycellOutput = p_psDBFetchResult(config->dbh); 1027 if (!skycellOutput) { 1028 psErrorCode err = psErrorCodeLast(); 1029 switch (err) { 1030 case PS_ERR_DB_CLIENT: 1031 psError(PXTOOLS_ERR_SYS, false, "database error"); 1032 case PS_ERR_DB_SERVER: 1033 psError(PXTOOLS_ERR_PROG, false, "database error"); 1034 default: 1035 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1036 } 1037 1038 return false; 1039 } 1040 // merge the arrays so that we can print them all at once 1041 if (psArrayLength(skycellOutput)) { 1042 int len = psArrayLength(skycellOutput); 1043 for (int i=0; i < len; i++) { 1044 psArrayAdd(output, 0, skycellOutput->data[i]); 1045 } 1046 } 1047 psFree(skycellOutput); 1025 1048 if (psArrayLength(output)) { 1026 if (limit && (limit < psArrayLength(output))) {1027 // truncate the array1028 long arrayLength = psArrayLength(output);1029 for (long i = arrayLength - 1; i >= limit; i--) {1030 psArrayRemoveIndex(output, i);1031 }1032 }1033 // negative simple so the default is true1034 1049 if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) { 1035 1050 psError(PS_ERR_UNKNOWN, false, "failed to print array"); … … 1037 1052 return false; 1038 1053 } 1039 } 1040 1054 } else { 1055 psTrace("magictool", PS_LOG_INFO, "no rows found"); 1056 } 1041 1057 psFree(output); 1042 1043 1058 return true; 1044 1059 } … … 1622 1637 return true; 1623 1638 } 1639 static bool setgotocleanedMode(pxConfig *config) 1640 { 1641 PS_ASSERT_PTR_NON_NULL(config, false); 1642 1643 psMetadata *where = psMetadataAlloc(); 1644 PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "=="); 1645 PXOPT_COPY_S64(config->args, where, "-exp_id", "magicRun.exp_id", "=="); 1646 PXOPT_COPY_STR(config->args, where, "-label", "magicRun.label", "LIKE"); 1647 PXOPT_COPY_STR(config->args, where, "-data_group", "magicRun.data_group", "LIKE"); 1648 1649 PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false); 1650 1651 psString query = psStringCopy("UPDATE magicRun SET workdir_state = 'goto_cleaned'\n"); 1652 if (set_label) { 1653 psStringAppend(&query, ", label = '%s'", set_label); 1654 } 1655 // This mode doubles as a revert function for cleanup errors 1656 PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false); 1657 if (!clearfault) { 1658 psStringAppend(&query, "WHERE workdir_state = 'dirty'"); 1659 } else { 1660 psStringAppend(&query, "WHERE workdir_state = 'error_cleaned'"); 1661 } 1662 psStringAppend(&query, "\nAND (magicRun.state = 'full' OR magicRun.state = 'drop')"); 1663 1664 // Require search parameters unless we're just clearing faults 1665 if (psListLength(where->list)) { 1666 psString clause = psDBGenerateWhereConditionSQL(where, NULL); 1667 psStringAppend(&query, "\nAND %s", clause); 1668 psFree(clause); 1669 psFree(where); 1670 } else if ( !clearfault) { 1671 psError(PS_ERR_UNKNOWN, false, "search parameters are required"); 1672 psFree(where); 1673 return false; 1674 } 1675 1676 if (!p_psDBRunQuery(config->dbh, query)) { 1677 psError(PS_ERR_UNKNOWN, false, "database error"); 1678 psFree(query); 1679 return false; 1680 } 1681 psFree(query); 1682 1683 return true; 1684 } 1685 1686 static bool setworkdirstateMode(pxConfig *config) 1687 { 1688 PS_ASSERT_PTR_NON_NULL(config, false); 1689 1690 // required 1691 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 1692 PXOPT_LOOKUP_STR(workdir_state, config->args, "-set_workdir_state", true, false); 1693 1694 if (strcmp(workdir_state, "cleaned") && strcmp(workdir_state, "error_cleaned")) { 1695 psError(PS_ERR_UNKNOWN, true, "%s is not a valid value for workdir_state", workdir_state); 1696 return false; 1697 } 1698 1699 psString query = NULL; 1700 psStringAppend(&query, "UPDATE magicRun SET workdir_state = '%s' WHERE magic_id = %" PRId64, workdir_state, magic_id); 1701 1702 if (!p_psDBRunQuery(config->dbh, query)) { 1703 psError(PS_ERR_UNKNOWN, false, "database error"); 1704 psFree(query); 1705 return false; 1706 } 1707 psFree(query); 1708 1709 return true; 1710 } 1711 static bool tocleanupMode(pxConfig *config) 1712 { 1713 PS_ASSERT_PTR_NON_NULL(config, false); 1714 1715 psMetadata *where = psMetadataAlloc(); 1716 PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "=="); 1717 pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "=="); 1718 pxAddLabelSearchArgs (config, where, "-data_group", "magicRun.data_group", "=="); 1719 1720 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1721 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1722 1723 psString query = pxDataGet("magictool_tocleanup.sql"); 1724 if (!query) { 1725 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1726 return false; 1727 } 1728 1729 if (psListLength(where->list)) { 1730 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1731 psStringAppend(&query, " AND %s", whereClause); 1732 psFree(whereClause); 1733 } 1734 psFree(where); 1735 1736 psStringAppend(&query, "\nORDER BY priority DESC, magic_id"); 1737 1738 // treat limit == 0 as "no limit" 1739 if (limit) { 1740 psString limitString = psDBGenerateLimitSQL(limit); 1741 psStringAppend(&query, " %s", limitString); 1742 psFree(limitString); 1743 } 1744 1745 if (!p_psDBRunQuery(config->dbh, query)) { 1746 psError(PS_ERR_UNKNOWN, false, "database error"); 1747 psFree(query); 1748 return false; 1749 } 1750 psFree(query); 1751 1752 psArray *output = p_psDBFetchResult(config->dbh); 1753 if (!output) { 1754 psErrorCode err = psErrorCodeLast(); 1755 switch (err) { 1756 case PS_ERR_DB_CLIENT: 1757 psError(PXTOOLS_ERR_SYS, false, "database error"); 1758 case PS_ERR_DB_SERVER: 1759 psError(PXTOOLS_ERR_PROG, false, "database error"); 1760 default: 1761 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1762 } 1763 1764 return false; 1765 } 1766 if (!psArrayLength(output)) { 1767 psTrace("magictool", PS_LOG_INFO, "no rows found"); 1768 psFree(output); 1769 return true; 1770 } 1771 1772 if (psArrayLength(output)) { 1773 // negative simple so the default is true 1774 if (!ippdbPrintMetadatas(stdout, output, "tocleanup", !simple)) { 1775 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1776 psFree(output); 1777 return false; 1778 } 1779 } 1780 1781 psFree(output); 1782 1783 return true; 1784 } -
branches/eam_branches/ipp-20101205/ippTools/src/magictool.h
r27982 r30446 43 43 MAGICTOOL_MODE_CENSORRUN, 44 44 MAGICTOOL_MODE_EXPOSURE, 45 MAGICTOOL_MODE_SETGOTOCLEANED, 46 MAGICTOOL_MODE_TOCLEANUP, 47 MAGICTOOL_MODE_SETWORKDIRSTATE, 45 48 } MAGICtoolMode; 46 49 -
branches/eam_branches/ipp-20101205/ippTools/src/magictoolConfig.c
r29495 r30446 178 178 psMetadataAddBool(exposureArgs, PS_LIST_TAIL, "-inverse", 0, "select the inverse subtraction?", false); 179 179 psMetadataAddBool(exposureArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 180 181 // -setgotocleaned 182 psMetadata *setgotocleanedArgs = psMetadataAlloc(); 183 psMetadataAddS64(setgotocleanedArgs, PS_LIST_TAIL, "-magic_id", 0, "select by magictool ID", 0); 184 psMetadataAddS64(setgotocleanedArgs, PS_LIST_TAIL, "-exp_id", 0, "select by exposure ID)", 0); 185 psMetadataAddStr(setgotocleanedArgs, PS_LIST_TAIL, "-label", 0, "select by label", NULL); 186 psMetadataAddStr(setgotocleanedArgs, PS_LIST_TAIL, "-data_group", 0, "select by data_group", NULL); 187 psMetadataAddStr(setgotocleanedArgs, PS_LIST_TAIL, "-set_label", 0, "set new label", NULL); 188 psMetadataAddBool(setgotocleanedArgs, PS_LIST_TAIL, "-clearfault", 0, "clear cleanup errors", NULL); 189 190 // -tocleanup 191 psMetadata *tocleanupArgs = psMetadataAlloc(); 192 psMetadataAddS64(tocleanupArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magic ID", 0); 193 psMetadataAddStr(tocleanupArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by label", NULL); 194 psMetadataAddStr(tocleanupArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by label", NULL); 195 psMetadataAddU64(tocleanupArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 196 psMetadataAddBool(tocleanupArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 197 198 // -setworkdirstate 199 psMetadata *setworkdirstateArgs = psMetadataAlloc(); 200 psMetadataAddS64(setworkdirstateArgs, PS_LIST_TAIL, "-magic_id", 0, "select by magictool ID (required)", 0); 201 psMetadataAddStr(setworkdirstateArgs, PS_LIST_TAIL, "-set_workdir_state", 0, "new workdir_state (required)", 0); 180 202 181 203 psFree(now); … … 202 224 PXOPT_ADD_MODE("-censorrun", "", MAGICTOOL_MODE_CENSORRUN, censorrunArgs); 203 225 PXOPT_ADD_MODE("-exposure", "", MAGICTOOL_MODE_EXPOSURE, exposureArgs); 226 PXOPT_ADD_MODE("-setgotocleaned", "", MAGICTOOL_MODE_SETGOTOCLEANED, setgotocleanedArgs); 227 PXOPT_ADD_MODE("-tocleanup", "", MAGICTOOL_MODE_TOCLEANUP, tocleanupArgs); 228 PXOPT_ADD_MODE("-setworkdirstate", "", MAGICTOOL_MODE_SETWORKDIRSTATE, setworkdirstateArgs); 204 229 205 230 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
branches/eam_branches/ipp-20101205/ippTools/src/pstamptool.c
r30102 r30446 134 134 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 135 135 PXOPT_LOOKUP_S32(pollInterval, config->args, "-set_poll_interval",false, false); 136 PXOPT_LOOKUP_BOOL(no_magic, config->args, "-set_no_magic", false); 137 138 bool need_magic = ! no_magic; 136 139 137 140 if (!pstampDataStoreInsert(config->dbh, … … 143 146 outProduct, 144 147 uri, 145 pollInterval 148 pollInterval, 149 need_magic 146 150 )) { 147 151 psError(PS_ERR_UNKNOWN, false, "database error"); -
branches/eam_branches/ipp-20101205/ippTools/src/pstamptoolConfig.c
r30102 r30446 51 51 psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-set_label", 0, "define datastore label", NULL); 52 52 psMetadataAddS32(adddatastoreArgs, PS_LIST_TAIL, "-set_poll_interval", 0, "define datastore poll interval (seconds)", 60); 53 psMetadataAddBool(adddatastoreArgs,PS_LIST_TAIL, "-set_no_magic", 0, "set magic not required", true); 53 54 54 55 // -datastore -
branches/eam_branches/ipp-20101205/ippTools/src/pubtool.c
r30102 r30446 167 167 PXOPT_COPY_STR(config->args, diffWhere, "-filter", "rawExp.filter", "LIKE"); 168 168 PXOPT_COPY_STR(config->args, diffWhere, "-obs_mode", "rawExp.obs_mode", "LIKE"); 169 PXOPT_COPY_STR(config->args, diffWhere, "-comment", "rawExp.comment", "LIKE"); 169 170 170 171 PXOPT_COPY_S64(config->args, camWhere, "-client_id", "client_id", "=="); -
branches/eam_branches/ipp-20101205/ippTools/src/pubtoolConfig.c
r30102 r30446 66 66 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "set and search by label", NULL); 67 67 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by data_group", NULL); 68 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-comment", 0, "search by comment", NULL); 68 69 psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL); 69 70 psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); -
branches/eam_branches/ipp-20101205/ippTools/src/pztool.c
r30102 r30446 47 47 static bool advanceMode(pxConfig *config); 48 48 49 static bool updatepzexpMode(pxConfig *config); 50 static bool updatenewexpMode(pxConfig *config); 51 49 52 // static bool copydoneCompleteExp(pxConfig *config); 50 53 static psArray *pzGetPendingCameras(pxConfig *config); … … 83 86 MODECASE(PZTOOL_MODE_TOADVANCE, toadvanceMode); 84 87 MODECASE(PZTOOL_MODE_ADVANCE, advanceMode); 88 MODECASE(PZTOOL_MODE_UPDATEPZEXP, updatepzexpMode); 89 MODECASE(PZTOOL_MODE_UPDATENEWEXP, updatenewexpMode); 85 90 default: 86 91 psAbort("invalid option (this should not happen)"); … … 294 299 295 300 psMetadata *where = psMetadataAlloc(); 296 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "=="); 297 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "=="); 298 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "=="); 299 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "=="); 301 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "=="); 302 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "=="); 303 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "=="); 304 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "=="); 305 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">="); 306 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<="); 300 307 301 308 PXOPT_LOOKUP_BOOL(desc, config->args, "-desc", false); … … 325 332 326 333 if (psListLength(where->list)) { 327 psString whereClause = psDBGenerateWhereConditionSQL(where, "pzDownloadImfile");334 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 328 335 psStringAppend(&query, " AND %s", whereClause); 329 336 psFree(whereClause); … … 889 896 || (strncmp(state, "stop", 5) == 0) 890 897 || (strncmp(state, "reg", 4) == 0) 898 || (strncmp(state, "drop", 5) == 0) 891 899 ) 892 900 ) { … … 905 913 } 906 914 915 static bool updatepzexpMode(pxConfig *config) 916 { 917 PS_ASSERT_PTR_NON_NULL(config, false); 918 PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false); 919 PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false); 920 PXOPT_LOOKUP_STR(telescope,config->args, "-telescope",true, false); 921 PXOPT_LOOKUP_STR(state, config->args, "-set_state",true, false); 922 923 if (!pzDownloadExpSetState(config,exp_name,camera,telescope,state)) { 924 psError(PS_ERR_UNKNOWN, false, "failed to change state for %s:%s:%s", exp_name, camera, telescope); 925 return false; 926 } 927 return true; 928 } 929 930 931 static bool updatenewexpMode(pxConfig *config) 932 { 933 PS_ASSERT_PTR_NON_NULL(config, false); 934 935 psMetadata *where = psMetadataAlloc(); 936 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 937 PXOPT_COPY_STR(config->args, where, "-exp_name", "tmp_exp_name", "=="); 938 939 PXOPT_LOOKUP_STR(new_state, config->args, "-set_state", true, false); 940 941 if (strcmp(new_state, "drop") && strcmp(new_state, "run") && strcmp(new_state, "wait")) { 942 psError(PXTOOLS_ERR_ARGUMENTS, true, "%s is not a valid value for -set_state", new_state); 943 psFree(where); 944 return false; 945 } 946 947 if (psListLength(where->list) < 1) { 948 psFree(where); 949 psError(PXTOOLS_ERR_CONFIG, false, "-exp_name or -exp_id is required"); 950 return false; 951 } 952 953 psString query = NULL; 954 psStringAppend(&query, "UPDATE newExp SET state = '%s'", new_state); 955 956 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 957 psStringAppend(&query, "\nWHERE %s", whereClause); 958 959 psFree(whereClause); 960 psFree(where); 961 962 if (!p_psDBRunQuery(config->dbh, query)) { 963 psError(PS_ERR_UNKNOWN, false, "database error"); 964 psFree(query); 965 return false; 966 } 967 psFree(query); 968 969 return true; 970 } 971 972 973 907 974 908 975 #if 0 -
branches/eam_branches/ipp-20101205/ippTools/src/pztool.h
r23497 r30446 36 36 PZTOOL_MODE_CLEARCOMMONFAULTS, 37 37 PZTOOL_MODE_TOADVANCE, 38 PZTOOL_MODE_ADVANCE 38 PZTOOL_MODE_ADVANCE, 39 PZTOOL_MODE_UPDATEPZEXP, 40 PZTOOL_MODE_UPDATENEWEXP, 39 41 } pztoolMode; 40 42 -
branches/eam_branches/ipp-20101205/ippTools/src/pztoolConfig.c
r27082 r30446 76 76 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0, "define camera ID", NULL); 77 77 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-telescope", 0, "define telescope ID", NULL); 78 psMetadataAddTime(pendingimfileArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL); 79 psMetadataAddTime(pendingimfileArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); 78 80 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0, "define exposure type", NULL); 79 81 psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-desc", 0, "sort ouput in descending format", false); … … 154 156 psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-label", 0, "define the label for the chip stage", NULL); 155 157 158 // -updatepzexp 159 psMetadata *updatepzexpArgs = psMetadataAlloc(); 160 psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-exp_name", 0, "search by exposure name (required)", NULL); 161 psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-inst", 0, "search by camera (required)", NULL); 162 psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-telescope", 0, "search by telescope (required)", NULL); 163 psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-set_state", 0, "define new state (required)", NULL); 164 165 // -updatenewexp 166 psMetadata *updatenewexpArgs = psMetadataAlloc(); 167 psMetadataAddS64(updatenewexpArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure ID", 0); 168 169 psMetadataAddStr(updatenewexpArgs, PS_LIST_TAIL, "-exp_name", 0, "define exposure ID", NULL); 170 psMetadataAddStr(updatenewexpArgs, PS_LIST_TAIL, "-set_state", 0, "define new state (required)", NULL); 171 156 172 psMetadata *argSets = psMetadataAlloc(); 157 173 psMetadata *modes = psMetadataAlloc(); … … 169 185 PXOPT_ADD_MODE("-toadvance", "", PZTOOL_MODE_TOADVANCE, toadvanceArgs); 170 186 PXOPT_ADD_MODE("-advance", "", PZTOOL_MODE_ADVANCE, advanceArgs); 187 PXOPT_ADD_MODE("-updatepzexp", "", PZTOOL_MODE_UPDATEPZEXP, updatepzexpArgs); 188 PXOPT_ADD_MODE("-updatenewexp", "", PZTOOL_MODE_UPDATENEWEXP,updatenewexpArgs); 171 189 172 190 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
branches/eam_branches/ipp-20101205/ippTools/src/regtool.c
r30102 r30446 51 51 static bool updatebyqueryMode(pxConfig *config); 52 52 53 static bool checkstatusMode(pxConfig *config); 54 53 55 static bool exportrunMode(pxConfig *config); 54 56 static bool importrunMode(pxConfig *config); … … 74 76 // imfile 75 77 MODECASE(REGTOOL_MODE_PENDINGIMFILE, pendingimfileMode); 76 MODECASE(REGTOOL_MODE_CHECKBURNTOOLIMFILE, checkburntoolimfileMode);77 MODECASE(REGTOOL_MODE_PENDINGBURNTOOLIMFILE, pendingburntoolimfileMode);78 MODECASE(REGTOOL_MODE_CHECKBURNTOOLIMFILE, checkburntoolimfileMode); 79 MODECASE(REGTOOL_MODE_PENDINGBURNTOOLIMFILE, pendingburntoolimfileMode); 78 80 MODECASE(REGTOOL_MODE_ADDPROCESSEDIMFILE, addprocessedimfileMode); 79 81 MODECASE(REGTOOL_MODE_PROCESSEDIMFILE, processedimfileMode); … … 90 92 MODECASE(REGTOOL_MODE_FINISHCOMPRESSEXP, finishcompressexpMode); 91 93 MODECASE(REGTOOL_MODE_CLEARDUPEXP, cleardupexpMode); 94 MODECASE(REGTOOL_MODE_CHECKSTATUS, checkstatusMode); 92 95 MODECASE(REGTOOL_MODE_EXPORTRUN, exportrunMode); 93 96 MODECASE(REGTOOL_MODE_IMPORTRUN, importrunMode); … … 95 98 psAbort("invalid option (this should not happen)"); 96 99 } 97 100 psTrace("regtool",9,"Attempting to free config\n"); 98 101 psFree(config); 99 102 pmConfigDone(); … … 180 183 } 181 184 185 186 187 182 188 static bool checkburntoolimfileMode(pxConfig *config) 183 189 { … … 187 193 PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false); 188 194 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 189 PXOPT_LOOKUP_STR(date, config->args, "-date", true, false); 195 PXOPT_LOOKUP_STR(dateobs_begin, config->args, "-dateobs_begin", true, false); 196 PXOPT_LOOKUP_STR(dateobs_end, config->args, "-dateobs_end", true, false); 190 197 PXOPT_LOOKUP_S32(valid_burntool, config->args, "-valid_burntool", true, false); 191 198 // optional … … 201 208 psFree(query); 202 209 query = rep; 210 211 // convert regular class_id format to summitImfile.class_id format 212 rep = psStringCopy(class_id); 213 psFree(class_id); 214 class_id = rep; 215 216 psStringSubstitute(&class_id,"ota","XY"); 203 217 204 218 psStringSubstitute(&query,exp_name,"@EXP_NAME@"); 205 219 psStringSubstitute(&query,class_id,"@CLASS_ID@"); 206 psStringSubstitute(&query,date,"@DATE@"); 207 208 fprintf(stderr,"%s",query); 220 psStringSubstitute(&query,dateobs_begin,"@DATEOBS_BEGIN@"); 221 psStringSubstitute(&query,dateobs_end,"@DATEOBS_END@"); 222 223 // fprintf(stderr,"%s",query); 209 224 210 225 if (!p_psDBRunQuery(config->dbh, query)) { … … 215 230 } 216 231 psFree(query); 217 232 218 233 psArray *output = p_psDBFetchResult(config->dbh); 219 234 if (!output) { … … 227 242 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 228 243 } 229 244 230 245 return false; 231 246 } 232 247 if (!psArrayLength(output)) { 233 248 psTrace("regtool", PS_LOG_INFO, "no rows found"); 234 psFree(output);235 249 return true; 236 250 } … … 242 256 psMetadata *row = output->data[i]; 243 257 258 if (strcasecmp(psMetadataLookupStr(NULL,row,"download_state"),"drop") == 0) { 259 continue; 260 } 261 244 262 if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)|| 245 (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {263 (psMetadataLookupS32(NULL,row,"is_registered") != 1)) { 246 264 ok_to_burn = false; 247 265 } … … 255 273 already_burned = false; 256 274 } 257 275 258 276 if (previous_uri) { 259 277 psMetadataAddStr(row,PS_LIST_TAIL,"previous_uri",PS_META_REPLACE,"",previous_uri); … … 264 282 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); 265 283 } 266 284 267 285 // negate simple so the default is true 268 286 if (!ippdbPrintMetadatas(stdout, output, "regBurntoolImfile", !simple)) { … … 271 289 return false; 272 290 } 273 291 274 292 psFree(output); 275 293 276 294 277 295 return(true); 278 296 279 297 } 280 298 … … 284 302 285 303 // required 286 PXOPT_LOOKUP_STR(date, config->args, "-date", true, false); 304 PXOPT_LOOKUP_STR(dateobs_begin, config->args, "-dateobs_begin", true, false); 305 PXOPT_LOOKUP_STR(dateobs_end, config->args, "-dateobs_end", true, false); 287 306 PXOPT_LOOKUP_S32(valid_burntool, config->args, "-valid_burntool", true, false); 288 307 // optional … … 297 316 psFree(query); 298 317 query = rep; 299 300 psStringSubstitute(&query,date,"@DATE@"); 301 302 // fprintf(stderr,"%s",query); 318 319 psStringSubstitute(&query,dateobs_begin,"@DATEOBS_BEGIN@"); 320 psStringSubstitute(&query,dateobs_end,"@DATEOBS_END@"); 321 322 // fprintf(stderr,"%s",query); 303 323 304 324 if (!p_psDBRunQuery(config->dbh, query)) { … … 309 329 } 310 330 psFree(query); 311 331 312 332 psArray *output = p_psDBFetchResult(config->dbh); 313 333 if (!output) { … … 321 341 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 322 342 } 323 343 324 344 return false; 325 345 } 346 347 // fprintf (stderr, "found %ld rows\n", output->n); 326 348 if (!psArrayLength(output)) { 327 349 psTrace("regtool", PS_LOG_INFO, "no rows found"); … … 337 359 psString this_class_id = NULL; 338 360 psArray *results = psArrayAllocEmpty(60); // List of suggested imfiles to burntool. 339 361 340 362 for (long i = 0; i < output->n; i++) { 341 363 psMetadata *row = output->data[i]; 342 364 365 if (strcasecmp(psMetadataLookupStr(NULL,row,"download_state"),"drop") == 0) { 366 continue; 367 } 368 369 bool status = false; 370 char *tmp_id = psMetadataLookupStr(&status,row,"summit_class_id"); 371 if (!status) { 372 // fprintf (stderr, "incomplete on %s\n", psMetadataLookupStr(NULL,row,"exp_name")); 373 continue; 374 } 375 343 376 // Add the information about this row and the previous, if it exists. 344 377 // Write the class_id stuff for debugging. 345 this_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id")); 346 psStringSubstitute(&this_class_id,"XY","ota"); 378 // this_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id")); 379 this_class_id = psStringCopy(tmp_id); 380 347 381 psMetadataAddStr(row,PS_LIST_TAIL,"this_class_id",PS_META_REPLACE,"",this_class_id); 382 348 383 if (previous_class_id) { 349 384 psMetadataAddStr(row,PS_LIST_TAIL,"previous_class_id",PS_META_REPLACE,"",previous_class_id); … … 353 388 continue; 354 389 } 390 391 if (0 && !strcmp(this_class_id, "ota44")) { 392 printf("STAT 1: %s (%d %d) %d %d %d\n", 393 this_class_id, 394 ok_to_burn, already_burned, 395 psMetadataLookupS32(NULL,row,"burntool_state"), 396 psMetadataLookupS32(NULL,row,"is_registered"), 397 psMetadataLookupS32(NULL,row,"is_downloaded")); 398 } 399 355 400 // Determine if we've crossed a class_id boundary, as this resets the bits. 356 401 if (previous_class_id) { 357 402 if (strcmp(this_class_id,previous_class_id) != 0) { 358 ok_to_burn = true; 359 already_burned = true; 360 previous_uri = NULL; 403 ok_to_burn = true; 404 already_burned = true; 405 previous_uri = NULL; 406 // fprintf (stderr, "crossed boundary: %s : %s to %s\n", psMetadataLookupStr(NULL,row,"exp_name"), previous_class_id, this_class_id); 361 407 } 362 408 } … … 364 410 // Write the URIs as well. 365 411 this_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Duplicate, but helpful for my debugging. 366 psMetadataAddStr(row,PS_LIST_TAIL,"this_uri",PS_META_REPLACE,"",this_uri); 412 psMetadataAddStr(row,PS_LIST_TAIL,"this_uri",PS_META_REPLACE,"",this_uri); 367 413 if (previous_uri) { 368 414 psMetadataAddStr(row,PS_LIST_TAIL,"previous_uri",PS_META_REPLACE,"",previous_uri); … … 372 418 // Convert bits of the SQL query into booleans describing the data state 373 419 if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)|| 374 (psMetadataLookupS32(NULL,row,"is_registered") != 1)) {375 // printf("I claim this isn't downloaded or registered? %s %s\n",this_uri,this_class_id);376 ok_to_burn = false;420 (psMetadataLookupS32(NULL,row,"is_registered") != 1)) { 421 // printf("I claim this isn't downloaded or registered? %s %s\n",this_uri,this_class_id); 422 ok_to_burn = false; 377 423 } 378 424 if (already_burned == false) { 379 //printf("already_burned looks false %s %s\n",this_uri,this_class_id);380 ok_to_burn = false;425 // printf("already_burned looks false %s %s\n",this_uri,this_class_id); 426 ok_to_burn = false; 381 427 } 382 428 if (abs(psMetadataLookupS32(NULL,row,"burntool_state")) == valid_burntool) { … … 391 437 // Check the uri for this exposure 392 438 if (!this_uri) { 393 ok_to_burn = false; 394 already_burned = false; 395 396 // Save this round for next round. 397 psFree(previous_class_id); 398 psFree(previous_uri); 399 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id")); 400 psStringSubstitute(&previous_class_id,"XY","ota"); 401 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 402 continue; 403 } 404 405 // printf("STATUS: %s %s %s %s (%d %d) %d %d %d\n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned,psMetadataLookupS32(NULL,row,"burntool_state"),psMetadataLookupS32(NULL,row,"is_registered"),psMetadataLookupS32(NULL,row,"is_downloaded")); 406 407 // If the state of this imfile is not "pending_burntool" then we can't burn it. 439 ok_to_burn = false; 440 already_burned = false; 441 442 // fprintf (stderr, "missing uri: %s %s\n", psMetadataLookupStr(NULL,row,"exp_name"), this_class_id); 443 444 // Save this round for next round. 445 psFree(previous_class_id); 446 psFree(previous_uri); 447 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id")); 448 psStringSubstitute(&previous_class_id,"ota","XY"); 449 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 450 continue; 451 } 452 453 if (0 && !strcmp(this_class_id, "ota44")) { 454 printf("STATUS: %s %s %s %s (%d %d) %d %d %d\n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned,psMetadataLookupS32(NULL,row,"burntool_state"),psMetadataLookupS32(NULL,row,"is_registered"),psMetadataLookupS32(NULL,row,"is_downloaded")); 455 } 456 // If the state of this imfile is not "pending_burntool" then we can't burn it. 408 457 if (!ignore_state) { 409 458 psString imfile_state = psMetadataLookupStr(NULL,row,"imfile_state"); 410 459 411 460 if (!imfile_state) { // imfile state is NULL, so we probably aren't registered. 412 ok_to_burn = false; 413 414 // Save this round for next round. 415 psFree(previous_class_id); 416 psFree(previous_uri); 417 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id")); 418 psStringSubstitute(&previous_class_id,"XY","ota"); 419 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 420 continue; 461 ok_to_burn = false; 462 463 // fprintf (stderr, "missing imfile_state: %s %s\n", psMetadataLookupStr(NULL,row,"exp_name"), this_class_id); 464 465 // Save this round for next round. 466 psFree(previous_class_id); 467 psFree(previous_uri); 468 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id")); 469 psStringSubstitute(&previous_class_id,"ota","XY"); 470 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 471 continue; 421 472 } 422 if (strcmp("pending_burntool",imfile_state) != 0) { // Probably the state is full, do not twiddle states 423 // Save this round for next round. 424 psFree(previous_class_id); 425 psFree(previous_uri); 426 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"tmp_class_id")); 427 psStringSubstitute(&previous_class_id,"XY","ota"); 428 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 429 continue; 473 if (strcmp("pending_burntool",imfile_state) != 0) { // Probably the state is full, do not twiddle states 474 475 if (0 && strcmp(imfile_state, "full")) { 476 fprintf (stderr, "not pending nor full: %s %s %s\n", psMetadataLookupStr(NULL,row,"exp_name"), this_class_id, imfile_state); 477 } 478 479 // Save this round for next round. 480 psFree(previous_class_id); 481 psFree(previous_uri); 482 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id")); 483 psStringSubstitute(&previous_class_id,"ota","XY"); 484 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 485 continue; 430 486 } 431 487 } 432 488 433 489 // Determine if we've already suggested an entry for this ota, and if not, copy this 434 490 // suggestion into our output result list. … … 437 493 psFree(previous_class_id); 438 494 psFree(previous_uri); 439 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row," tmp_class_id"));440 psStringSubstitute(&previous_class_id," XY","ota");441 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 495 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id")); 496 psStringSubstitute(&previous_class_id,"ota","XY"); 497 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 442 498 continue; 443 499 } … … 448 504 psFree(previous_class_id); 449 505 psFree(previous_uri); 450 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row," tmp_class_id"));451 psStringSubstitute(&previous_class_id," XY","ota");452 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 453 } 454 506 previous_class_id = psStringCopy(psMetadataLookupStr(NULL,row,"summit_class_id")); 507 psStringSubstitute(&previous_class_id,"ota","XY"); 508 previous_uri = psStringCopy(psMetadataLookupStr(NULL,row,"uri")); // Save for next round. 509 } 510 455 511 // negate simple so the default is true 456 512 if (!ippdbPrintMetadatas(stdout, results, "regPendingBurntoolImfile", !simple)) { … … 460 516 return false; 461 517 } 462 518 463 519 psFree(output); 464 520 psFree(results); 465 521 466 522 467 523 return(true); 468 469 } 470 471 524 525 } 526 527 472 528 473 529 static bool addprocessedimfileMode(pxConfig *config) … … 545 601 PXOPT_LOOKUP_STR(md5sum, config->args, "-md5sum", false, false); 546 602 PXOPT_LOOKUP_BOOL(video_cells, config->args, "-video_cells", false); 547 603 548 604 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 549 605 PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false); … … 618 674 bytes, 619 675 md5sum, 620 video_cells, 621 0 // burntool_state676 0, // burntool_state 677 video_cells 622 678 )) { 623 679 psError(PS_ERR_UNKNOWN, false, "database error"); … … 771 827 psStringAppend(&query, " AND %s", whereClause); 772 828 psFree(whereClause); 773 } else {774 psFree(where);775 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");776 return false;777 829 } 778 830 psFree(where); … … 806 858 PXOPT_LOOKUP_STR(set_state, config->args, "-set_state", false, false); 807 859 808 if ((fault == INT16_MAX) && !isfinite(burntool_state) && !(set_state)) {860 if ((fault == INT16_MAX) && (burntool_state == INT16_MAX) && !set_state) { 809 861 psError(PS_ERR_UNKNOWN, false, "one of -fault or -burntool_state or -set_state must be selected"); 810 862 return false; 811 863 } 812 if ((fault != INT16_MAX) && isfinite(burntool_state)) {864 if ((fault != INT16_MAX) && (burntool_state != INT16_MAX)) { 813 865 psError(PS_ERR_UNKNOWN, false, "only one of -fault or -burntool_state must be selected"); 814 866 return false; … … 1312 1364 if (!pxchipQueueByExpTag(config, 1313 1365 exp_id, 1314 chip_workdir,1366 chip_workdir, 1315 1367 label, 1316 data_group,1317 dist_group,1368 data_group, 1369 dist_group, 1318 1370 reduction, 1319 1371 NULL, // expgroup … … 1831 1883 } 1832 1884 1885 static bool checkstatusMode(pxConfig *config) 1886 { 1887 PS_ASSERT_PTR_NON_NULL(config,false); 1888 1889 // required 1890 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 1891 // Conditionally required 1892 PXOPT_LOOKUP_STR(dateobs_begin, config->args, "-dateobs_begin", false, false); 1893 PXOPT_LOOKUP_STR(dateobs_end, config->args, "-dateobs_end", false, false); 1894 PXOPT_LOOKUP_STR(date, config->args, "-date", false, false); 1895 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1896 1897 psString query = pxDataGet("regtool_checkstatus.sql"); 1898 if (!query) { 1899 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); 1900 return false; 1901 } 1902 psString rep = psStringCopy(query); 1903 psFree(query); 1904 query = rep; 1905 psStringSubstitute(&class_id,"ota","XY"); 1906 psStringSubstitute(&query,class_id,"@CLASS_ID@"); 1907 1908 if (!date) { 1909 if (!dateobs_begin || !dateobs_end) { 1910 psError(PXTOOLS_ERR_CONFIG, false, "Either -date or -dateobs_begin -dateobs_end is required"); 1911 psFree(query); 1912 return false; 1913 } 1914 psStringAppend(&query," AND summitExp.dateobs >= '%s' AND summitExp.dateobs <= '%s' ", 1915 dateobs_begin,dateobs_end); 1916 } 1917 else { 1918 psStringAppend(&query," AND summitExp.dateobs >= '%sT00:00:00' AND summitExp.dateobs <= '%sT23:59:59' ", 1919 date,date); 1920 } 1921 1922 psStringAppend(&query," ORDER BY summitExp.dateobs "); 1923 1924 if (!p_psDBRunQuery(config->dbh, query)) { 1925 // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms) 1926 psError(PXTOOLS_ERR_PROG, false, "database error"); 1927 psFree(query); 1928 return false; 1929 } 1930 psFree(query); 1931 1932 psArray *output = p_psDBFetchResult(config->dbh); 1933 if (!output) { 1934 psErrorCode err = psErrorCodeLast(); 1935 switch (err) { 1936 case PS_ERR_DB_CLIENT: 1937 psError(PXTOOLS_ERR_SYS, false, "database error"); 1938 case PS_ERR_DB_SERVER: 1939 psError(PXTOOLS_ERR_PROG, false, "database error"); 1940 default: 1941 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1942 } 1943 1944 return false; 1945 } 1946 if (!psArrayLength(output)) { 1947 psTrace("regtool", PS_LOG_INFO, "no rows found"); 1948 return true; 1949 } 1950 1951 if (!ippdbPrintMetadatas(stdout, output, "regCheckStatus", !simple)) { 1952 psError(PXTOOLS_ERR_PROG, false, "failed to print array"); 1953 psFree(output); 1954 return false; 1955 } 1956 1957 psFree(output); 1958 1959 return(true); 1960 } 1961 1833 1962 bool exportrunMode(pxConfig *config) 1834 1963 { -
branches/eam_branches/ipp-20101205/ippTools/src/regtool.h
r30102 r30446 41 41 REGTOOL_MODE_PENDINGCOMPRESSIMFILE, 42 42 REGTOOL_MODE_FINISHCOMPRESSEXP, 43 REGTOOL_MODE_CHECKSTATUS, 43 44 REGTOOL_MODE_EXPORTRUN, 44 45 REGTOOL_MODE_IMPORTRUN -
branches/eam_branches/ipp-20101205/ippTools/src/regtoolConfig.c
r30102 r30446 57 57 ADD_OPT(Str, checkburntoolimfileArgs, "-exp_name", "define the exp_name (required)", NULL); 58 58 ADD_OPT(Str, checkburntoolimfileArgs, "-class_id", "define class ID (required)", NULL); 59 ADD_OPT(Str, checkburntoolimfileArgs, "-date", "select the date to process (required)", NULL); 59 ADD_OPT(Str, checkburntoolimfileArgs, "-dateobs_begin", "set the earliest summit dateobs to consider (required)", NULL); 60 ADD_OPT(Str, checkburntoolimfileArgs, "-dateobs_end", "set the latest summit dateobs to consider (required)", NULL); 60 61 ADD_OPT(S32, checkburntoolimfileArgs, "-valid_burntool", "define the good burntool value (required)", 0); 61 62 ADD_OPT(Str, checkburntoolimfileArgs, "-inst", "define the camera name", NULL); … … 65 66 // -pendingburntoolimfile 66 67 psMetadata *pendingburntoolimfileArgs = psMetadataAlloc(); 67 ADD_OPT(Str, pendingburntoolimfileArgs, "-date", "select the date to process (required)", NULL); 68 ADD_OPT(Str, pendingburntoolimfileArgs, "-dateobs_begin", "set the earliest summit dateobs to consider (required)", NULL); 69 ADD_OPT(Str, pendingburntoolimfileArgs, "-dateobs_end", "set the latest summit dateobs to consider (required)", NULL); 68 70 ADD_OPT(S32, pendingburntoolimfileArgs, "-valid_burntool", "define the good burntool value (required)", 0); 69 71 ADD_OPT(Bool, pendingburntoolimfileArgs, "-simple", "use the simple output format", false); 70 72 ADD_OPT(Bool, pendingburntoolimfileArgs, "-ignore_state", "ignore the data_state when deciding what to work on", false); 71 73 ADD_OPT(U64, pendingburntoolimfileArgs, "-limit", "limit result set to N items", 0); 72 74 73 75 // -addprocessedimfile 74 76 psMetadata *addprocessedimfileArgs = psMetadataAlloc(); … … 178 180 ADD_OPT(S64, revertprocessedimfileArgs, "-exp_id_begin", "search by exposure ID", 0); 179 181 ADD_OPT(S64, revertprocessedimfileArgs, "-exp_id_end", "search by exposure ID", 0); 182 // This argument is not used but is needed because the task uses add.poll.args 183 ADD_OPT(U64, revertprocessedimfileArgs, "-limit", "for compatability not used", 0); 180 184 181 185 // -updateprocessedimfile … … 415 419 psMetadataAddBool(finishcompressexpArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 416 420 psMetadataAddU64(finishcompressexpArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 421 422 // -checkstatus 423 psMetadata *checkstatusArgs = psMetadataAlloc(); 424 ADD_OPT(Str, checkstatusArgs, "-dateobs_begin", "set the earlist summit dateobs to consider", NULL); 425 ADD_OPT(Str, checkstatusArgs, "-dateobs_end", "set the latest summit dateobs to consider", NULL); 426 ADD_OPT(Str, checkstatusArgs, "-date", "use default observing extent and look over entire night", NULL); 427 ADD_OPT(Str, checkstatusArgs, "-class_id", "define class ID (required)", NULL); 428 ADD_OPT(Bool, checkstatusArgs, "-simple", "use the simple output format", false); 417 429 418 430 psMetadata *argSets = psMetadataAlloc(); … … 435 447 PXOPT_ADD_MODE("-pendingcompressimfile", "", REGTOOL_MODE_PENDINGCOMPRESSIMFILE, pendingcompressimfileArgs); 436 448 PXOPT_ADD_MODE("-finishcompressexp", "", REGTOOL_MODE_FINISHCOMPRESSEXP, finishcompressexpArgs); 449 PXOPT_ADD_MODE("-checkstatus", "", REGTOOL_MODE_CHECKSTATUS, checkstatusArgs); 437 450 PXOPT_ADD_MODE("-exportrun", "export run for import on other database", REGTOOL_MODE_EXPORTRUN, exportrunArgs); 438 451 PXOPT_ADD_MODE("-importrun", "import run from metadata file", REGTOOL_MODE_IMPORTRUN, importrunArgs); -
branches/eam_branches/ipp-20101205/ippTools/src/stacktool.c
r29418 r30446 497 497 psError(PS_ERR_UNKNOWN, false, "database error"); 498 498 psFree(output); 499 psFree(run);500 499 psFree(insert); 501 500 psFree(list); … … 517 516 psError(PS_ERR_UNKNOWN, false, "database error"); 518 517 psFree(output); 519 psFree(run);520 518 psFree(insert); 521 519 psFree(list); -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_checkdependent.pl
r29624 r30446 690 690 if ($dsfile->{data_state} eq 'cleaned') { 691 691 $command = "$magicdstool -setfiletoupdate -magic_ds_id $magic_ds_id -component $c"; 692 # XXX: get the recoveryroot from a config file (it isn't actually used except to check whether it is in nebulous) 693 $command .= " -set_recoveryroot neb://any/gpc1/destreak/recover"; 692 694 $command .= " -set_label $rlabel" if $rlabel; 693 695 if (!$no_update) { -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_job_run.pl
r30103 r30446 14 14 use File::Basename; 15 15 use File::Copy; 16 use File::Temp qw(tempfile); 16 17 use Digest::MD5::File qw( file_md5_hex ); 17 18 use PS::IPP::PStamp::RequestFile qw( :standard ); 19 use PS::IPP::PStamp::Job qw( :standard ); 18 20 use IPC::Cmd 0.36 qw( can_run run ); 19 21 use POSIX; … … 26 28 27 29 my ($job_id, $redirect_output, $outputBase, $rownum, $jobType, $options); 28 my ($verbose, $dbname, $dbserver, $no_update );30 my ($verbose, $dbname, $dbserver, $no_update, $save_temps); 29 31 30 32 GetOptions( … … 39 41 'verbose' => \$verbose, 40 42 'no-update' => \$no_update, 43 'save-temps' => \$save_temps, 41 44 ); 42 45 … … 75 78 my $pstamp_get_image_job = can_run('pstamp_get_image_job.pl') or (warn "Can't find pstamp_get_image_job.pl" and $missing_tools = 1); 76 79 my $dqueryparse = can_run('dqueryparse.pl') or (warn "Can't find dqueryparse.pl" and $missing_tools = 1); 80 my $streaksreplace = can_run('streaksreplace') or (warn "Can't find streaksreplace" and $missing_tools = 1); 81 my $magicdstool = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1); 77 82 78 83 if ($missing_tools) { … … 88 93 my $argString; 89 94 $argString = $params->{job_args}; 95 my $stage = $params->{stage}; 90 96 91 97 # XXX: should we do any other sanity checking? 92 98 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 93 99 94 $argString .= " -file $params->{image}"; 100 my $nan_masked = 1; 101 my $muggle = 0; 102 if (!$params->{magicked}) { 103 $nan_masked = 0; 104 } elsif ($params->{magicked} and ($options & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED))) { 105 # Attempt to find or create a muggle image 106 $nan_masked = 0; 107 $muggle = 1; 108 } 109 110 my $image = $params->{image}; 111 my $mask; 112 my $variance; 113 my $fileArgs = " -file $params->{image}"; 95 114 my @file_list = ($params->{image}); 96 115 97 my $nan_masked = 1;98 if (!$params->{magicked}) {99 $nan_masked = 0;100 }101 116 if ($nan_masked or ($options & $PSTAMP_SELECT_MASK)) { 102 $argString .= " -mask $params->{mask}"; 103 push @file_list, $params->{mask}; 117 $mask = $params->{mask}; 118 $fileArgs .= " -mask $mask"; 119 push @file_list, $mask; 104 120 } 105 121 if ($options & $PSTAMP_SELECT_VARIANCE) { 106 $argString .= " -variance $params->{weight}"; 107 push @file_list, $params->{weight}; 122 $variance = $params->{weight}; 123 $fileArgs .= " -variance $variance"; 124 push @file_list, $variance; 108 125 } 109 126 … … 113 130 } 114 131 115 check_files(@file_list); 116 117 my $command = "$ppstamp $outputBase $argString"; 132 # check that actual input files exist 133 check_files($PSTAMP_GONE, @file_list); 134 135 # find our output directory 136 my $outdir = dirname($outputBase); 137 my ($tmpImage, $tmpMask, $tmpVariance, $tmproot); 138 139 if ($muggle) { 140 # first see if the original uncensored images are around 141 if (check_for_backups($params, \$fileArgs)) { 142 # We're good to go. fileArgs has been edited to contain the paths for the original uncensored images 143 print "Making stamps from backup images\n"; 144 } elsif (($options & $PSTAMP_REQUIRE_UNCENSORED) and ($stage ne 'chip')) { 145 # user required uncensored but since stage isn't chip we can't rebuild them 146 my_die("uncensored inputs not available for job $job_id", $job_id, $PSTAMP_NOT_AVAILABLE); 147 } elsif (($options & $PSTAMP_REQUEST_UNCENSORED) and ($stage ne 'chip')) { 148 # make stamps from uncensored images 149 $muggle = 0; 150 } else { 151 # Try and replace the streaks from the recovery images 152 153 @file_list = (); 154 $tmproot = "$outdir/$job_id"; 155 mkdir $tmproot or 156 my_die( "failed to create temporary directory $tmproot", $job_id, $PS_EXIT_UNKNOWN_ERROR); 157 my $muggle_command = "$streaksreplace -stage $stage -tmproot $tmproot"; 158 # find the "directory" of the input path_base 159 my $inputdir = dirname($image); 160 my $base = basename($image); 161 $tmpImage = "$tmproot/$base"; 162 163 # XXX: We should get the recovery_path_base from the magicDSFile but that requires a bunch of file rule and 164 # stage work. Import the rule here. 165 my $recImage = "$inputdir/REC_$base"; 166 my $newFileArgs = " -file $tmpImage"; 167 $muggle_command .= " -image $image -recimage $recImage"; 168 push @file_list, $recImage; 169 170 if ($mask) { 171 $base = basename($mask); 172 $tmpMask = "$tmproot/$base"; 173 $newFileArgs .= " -mask $tmpMask"; 174 my $recMask = "$inputdir/REC_$base"; 175 $muggle_command .= " -mask $mask -recmask $recMask"; 176 push @file_list, $recMask; 177 } 178 179 if ($variance) { 180 $base = basename($variance); 181 $tmpVariance = "$tmproot/$base"; 182 $newFileArgs .= " -weight $tmpVariance"; 183 my $recVariance = "$inputdir/REC_$base"; 184 $muggle_command .= " -weight $variance -recweight $recVariance"; 185 push @file_list, $recVariance; 186 } 187 if (check_files(0, @file_list)) { 188 # recovery files exist and are accessible restore the excised pixels 189 190 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 191 run(command => $muggle_command, verbose => $verbose); 192 unless ($success) { 193 my $exitStatus = WEXITSTATUS($error_code); 194 my_die( "streaksreplace failed with error code: $exitStatus", $job_id, $exitStatus); 195 } 196 197 # set the ppstamp file arguments 198 $fileArgs = $newFileArgs; 199 } else { 200 if ($options & $PSTAMP_REQUIRE_UNCENSORED) { 201 my_die( "unable to restore uncensored images", $job_id, $PSTAMP_NOT_AVAILABLE); 202 } 203 # just make stamps from the censored images 204 print "Unable to restore uncensored images, will extract stamps from censored images\n"; 205 # these files won't be used so zap them 206 ($tmpImage, $tmpMask, $tmpVariance, $tmproot) = (undef, undef, undef, undef); 207 } 208 } 209 } 210 211 my $command = "$ppstamp $outputBase $argString $fileArgs"; 118 212 $command .= " -dbname $dbname" if $dbname; 119 213 $command .= " -dbserver $dbserver" if $dbserver; 120 $command .= " -stage $ params->{stage}" if $params->{stage};214 $command .= " -stage $stage"; 121 215 $command .= " -no_censor_masked" unless $nan_masked; 122 216 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 131 225 } 132 226 227 if (!$save_temps) { 228 unlink $tmpImage if $tmpImage; 229 unlink $tmpMask if $tmpMask; 230 unlink $tmpVariance if $tmpVariance; 231 rmdir $tmproot if $tmproot; 232 } 233 133 234 if ($exitStatus == 0) { 134 my $dir = dirname($outputBase); 135 136 my $reglist = "$dir/reglist$job_id"; 235 my $reglist = "$outdir/reglist$job_id"; 137 236 138 237 my $F; … … 363 462 364 463 sub check_files { 464 my $error_code = shift; 465 my $return_code = 1; 365 466 foreach my $f (@_) { 366 467 if (!$ipprc->file_exists($f)) { 367 my_die( "file $f does not exist:", $job_id, $PSTAMP_GONE, 'stop'); 368 } 369 } 468 if ($error_code) { 469 my_die( "file $f does not exist:", $job_id, $error_code, 'stop'); 470 } else { 471 print STDERR "file $f does not exist\n"; 472 $return_code = 0; 473 } 474 } 475 } 476 return $return_code; 477 } 478 479 sub check_for_backups { 480 my $params = shift; 481 my $r_fileArgs = shift; 482 483 my $command = "$magicdstool -destreakedfile -stage $params->{stage} -stage_id $params->{stage_id} -component $params->{component} -dbname $params->{imagedb}"; 484 my $results = runToolAndParse($command, $verbose); 485 my $dsComponent = $results->[0]; 486 487 if ($dsComponent and ($dsComponent->{data_state} eq 'full')) { 488 489 print "magicDSFile state is full. Backup images should exist\n"; 490 491 # replace the file names with the backup paths 492 # fileArgs has the form: -file imagename [-mask maskname] [-weight weightname] 493 my @args = split " ", $$r_fileArgs; 494 495 my $newFileArgs; 496 while (@args) { 497 my $a = shift @args; 498 my $f = shift @args; 499 my_die( "unexpected fileArg list $$r_fileArgs", $job_id, $PS_EXIT_PROG_ERROR, 'run') if !$a or !$f; 500 501 my $backup_image_name = $ipprc->destreaked_filename($f); 502 my_die( "failed to extract backup image name from $f", $job_id, $PS_EXIT_PROG_ERROR, 'run') if !$backup_image_name; 503 $newFileArgs .= " $a $backup_image_name"; 504 } 505 $$r_fileArgs = $newFileArgs; 506 507 return 1; 508 } 509 510 return 0; 370 511 } 371 512 -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_parser_run.pl
r29576 r30446 31 31 my $outdir; 32 32 my $label; 33 my $need_magic; 33 34 my $verbose; 34 35 my $dbname; … … 41 42 'outdir=s' => \$outdir, 42 43 'label=s' => \$label, 44 'need_magic' => \$need_magic, 43 45 'redirect-output' => \$redirect_output, 44 46 'verbose' => \$verbose, … … 160 162 $parse_cmd = "$pstampparse"; 161 163 $parse_cmd .= " --label $label" if $label; 164 $parse_cmd .= " --need_magic" if $need_magic; 162 165 $request_fault = 0; 163 166 } elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") { -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_server_status
r29572 r30446 44 44 chdir $rundir or die "failed to cd to $rundir"; 45 45 46 47 my $down = 0; 48 if ($down) { 49 print "Postage Stamp Server will be down for maintenance it will back at approximately 00:00 2010-12-11 UTC\n"; 50 exit 0; 51 } 46 52 47 53 my ($pts, $pantasks_script) = tempfile ('/tmp/pts.XXXX', UNLINK => !$save_temps); -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstampparse.pl
r30103 r30446 30 30 my $save_temps; 31 31 my $no_update; 32 my $dest_requires_magic; 32 33 33 34 GetOptions( … … 38 39 'label=s' => \$label, 39 40 'mode=s' => \$mode, 41 'need_magic'=> \$dest_requires_magic, 40 42 'dbname=s' => \$dbname, 41 43 'dbserver=s'=> \$dbserver, … … 126 128 } 127 129 128 # Adjust the label for requests coming in over the web interaface 130 131 # Adjust the label for requests coming in over the web interface 129 132 130 133 my $label_changed = 0; … … 384 387 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 385 388 if (!$proj_hash) { 386 foreach $row(@$rowList) {387 insertFakeJobForRow($r ow, 1, $PSTAMP_UNKNOWN_PRODUCT);389 foreach my $r (@$rowList) { 390 insertFakeJobForRow($r, 1, $PSTAMP_UNKNOWN_PRODUCT); 388 391 $num_jobs++; 389 392 } … … 409 412 $need_magic = $proj_hash->{need_magic}; 410 413 411 # Temporary hack so that IFA can get at non-magicked data412 my $allow_mops_unmagicked = 1;413 if ($allow_mops_unmagicked) {414 if ($product and (($product eq "mops-pstamp-results") or415 ($product eq "mops-pstamp-results2") or416 ($product eq "ifa-pstamp-results"))) {417 $need_magic = 0;418 }419 }420 421 414 $need_magic = 0 if $stage eq 'stack'; 415 416 if ($need_magic) { 417 418 # this project requires that postage stamps be extracted from destreaked images 419 420 if ($option_mask & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED)) { 421 # The user has requested uncensored stamps 422 423 if (!$dest_requires_magic) { 424 # and this user's data store destination is allowed uncensored stamps, so accept the request 425 $need_magic = 0; 426 } else { 427 print STDERR "Error row $rownum: User not authorized to to request uncensored stamps.\n"; 428 if ($option_mask & $PSTAMP_REQUIRE_UNCENSORED) { 429 # user required uncensored stamps. Can't do it so fail. 430 foreach my $r (@$rowList) { 431 insertFakeJobForRow($r, 1, $PSTAMP_NOT_AUTHORIZED); 432 $num_jobs++; 433 } 434 return $num_jobs; 435 } 436 437 # user will accept censored stamps. alter OPTION_MASK and continue 438 439 print STDERR " Will attempt to make destreaked stamps\n"; 440 # zap the offending bit in the option mask 441 $option_mask = $option_mask ^ ($PSTAMP_REQUEST_UNCENSORED); 442 foreach my $r (@$rowList) { 443 $r->{OPTION_MASK} = $option_mask; 444 } 445 } 446 } 447 } 422 448 423 449 my $numRows = scalar @$rowList; -
branches/eam_branches/ipp-20101205/tools/czarclean.pl
r29278 r30446 6 6 7 7 # local classes 8 use czartool::Config; 8 9 use czartool::CzarDb; 9 10 10 11 my $czarDbName = undef; 11 my $ from= undef;12 my $ to= undef;12 my $begin = undef; 13 my $end = undef; 13 14 my $interval = undef; 14 15 my $verbose = undef; 15 16 my $optimize = undef; 17 my $config = new czartool::Config(); 16 18 17 19 GetOptions ( 18 20 "dbname|d=s" => \$czarDbName, 19 21 "interval|i=s" => \$interval, 20 " from|f=s" => \$from,21 " to|t=s" => \$to,22 "begin|b=s" => \$begin, 23 "end|e=s" => \$end, 22 24 "optimize|o" => \$optimize, 23 25 "verbose|v" => \$verbose, … … 32 34 print "* UNKNKOWN: option @ARGV\n"; 33 35 } 34 if (!$ from) {36 if (!$begin) { 35 37 $quit=1; 36 print "* REQUIRED: choose a from date-b <datetime>\n";38 print "* REQUIRED: choose a begin date -b <datetime>\n"; 37 39 } 38 if (!$ to) {39 if($ from) {$to=$from;} else {$to="NULL";}40 print "* OPTIONAL: choose a to date -e <datetime> (default=$to)\n";40 if (!$end) { 41 if($begin) {$end=$begin;} else {$end="NULL";} 42 print "* OPTIONAL: choose an end date date -e <datetime> (default=$end)\n"; 41 43 } 42 44 if (!$czarDbName) { … … 45 47 } 46 48 if (!$interval) { 47 $interval = "30 MINUTE"; 48 print "* OPTIONAL: choose time interval -i <'30 MINUTE'|'1 hour'|etc> (default=$interval)\n"; 49 print "* OPTIONAL: choose time interval -i <'30 MINUTE'|'1 hour'|etc> (default=".$config->getCzarCleanupInterval().")\n"; 49 50 } 50 51 if (!$optimize) { 51 52 $optimize = 0; 52 print "* OPTIONAL: optimize database after cleanup -o <'30 MINUTE'|'1 hour'|etc> (default=$interval)\n";53 print "* OPTIONAL: optimize database after cleanup -o (default=$optimize)\n"; 53 54 } 54 55 print "*\n*******************************************************************************\n"; … … 56 57 if ($quit) { exit; } 57 58 58 59 my $save_temps = 0; 60 61 62 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 59 my $czarDb = $config->getCzarDbInstance(); 63 60 64 61 my $labels = undef; 65 62 66 63 67 $czarDb->cleanupDateRange($ from, $to, $interval);64 $czarDb->cleanupDateRange($begin, $end, $config->getCzarCleanupInterval()); 68 65 if ($optimize) {$czarDb->optimize();} -
branches/eam_branches/ipp-20101205/tools/czarmetrics.pl
r29868 r30446 8 8 use CGI::Pretty qw[:standard]; 9 9 10 use czartool::Config; 10 11 use czartool::DayMetrics; 11 12 use czartool::MultiDayMetrics; 12 13 use czartool::MetricsIndex; 13 use czartool::CzarDb;14 use czartool::Gpc1Db;15 14 16 15 my $czarDbName = "czardb"; … … 60 59 if ($quit) {exit;} 61 60 62 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 63 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", $verbose, $save_temps); 64 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 61 my $config = new czartool::Config(); 65 62 66 63 if ($index) { 67 64 68 my $metricsIndex = new czartool::MetricsIndex($ gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0);65 my $metricsIndex = new czartool::MetricsIndex($config, 1, 0); 69 66 $metricsIndex->writeHTML(); 70 67 exit; … … 82 79 if ($cumulative) { 83 80 84 my $multiDayMetrics = new czartool::MultiDayMetrics($ gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $begin, $end);81 my $multiDayMetrics = new czartool::MultiDayMetrics($config, 1, 0, $begin, $end); 85 82 $multiDayMetrics->writeHTML(); 86 83 } 87 84 else { 88 85 86 my $czarDb = $config->getCzarDbInstance(); 87 89 88 while (1) { 90 89 91 my $dayMetrics = new czartool::DayMetrics($ gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $thisDay);90 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $thisDay); 92 91 $dayMetrics->writeHTML(); 93 92 -
branches/eam_branches/ipp-20101205/tools/czarplot.pl
r29952 r30446 7 7 use POSIX qw/strftime/; 8 8 9 use czartool::CzarDb; 10 use czartool::Gpc1Db; 9 use czartool::Config; 11 10 use czartool::Plotter; 12 11 use czartool::StageMetrics; 13 12 14 my $czarDbName = "czardb";15 13 my $label = undef; 16 14 my $stage = undef; … … 36 34 37 35 GetOptions ( 38 "dbname=s" => \$czarDbName,39 36 "label|l=s" => \$label, 40 37 "stage|s=s" => \$stage, … … 114 111 if ($quit) { exit; } 115 112 113 my $config = new czartool::Config(); 114 116 115 # default values 117 116 if (!$rate && !$magicMask && !$nebulous && !$histogram && !$analysis && !$timeSeries) {$timeSeries = 1;} … … 121 120 else {$savingToFile = 1;} 122 121 123 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 124 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", $verbose, $save_temps); 125 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 122 my $czarDb = $config->getCzarDbInstance(); 126 123 124 my $newDayTime = $config->getMetricsStartTime(); 127 125 128 126 my $plotter = undef; 129 127 if ($savingToFile) { 130 128 131 $plotter = czartool::Plotter->new_file( 132 $gpc1Db, 133 $czarDb, 134 $path, 135 $save_temps); 129 $plotter = czartool::Plotter->new_file($config, $path, $save_temps); 136 130 } 137 131 else { 138 132 139 $plotter = czartool::Plotter->new_display( 140 $gpc1Db, 141 $czarDb, 142 $save_temps); 133 $plotter = czartool::Plotter->new_display($config, $save_temps); 143 134 } 144 135 145 # sort out times136 # if a single day has been chosen 146 137 if($day) { 147 138 148 139 if ($magicMask) { 149 140 150 $begin = $day;141 $begin = $day; 151 142 $end = $day; 152 143 } 153 144 else { 154 145 155 # day plots should run from about 6:30am until midnight 156 $begin = "$day 06:35"; 157 $end = "$day 23:59"; 146 # plots should span 24 housr from previous day 147 my $dayBefore = $czarDb->subtractInterval($day, "1 DAY"); 148 149 $begin = "$dayBefore $newDayTime"; 150 $end = "$day $newDayTime"; 158 151 } 159 152 } … … 163 156 if (!$begin) { 164 157 158 my $today = strftime('%Y-%m-%d', localtime); 159 my $yesterday = $czarDb->subtractInterval($today, "1 DAY"); 160 161 165 162 if ($timeinpast) {$begin = $czarDb->subtractInterval($end, $timeinpast);} 166 else {$begin = strftime('%Y-%m-%d 06:35',localtime);} 163 elsif ($czarDb->isBefore($end, "$today $newDayTime")) {$begin = "$yesterday $newDayTime";} 164 else {$begin = "$today $newDayTime";} 167 165 } 168 166 } 167 169 168 if ($rate) { 170 169 -
branches/eam_branches/ipp-20101205/tools/czarpoll.pl
r30102 r30446 1 1 #!/usr/bin/perl -w 2 3 ########################################################################### 4 # 5 # Main polling program for czartool. Grabs stuff from various sources every few minutes. 6 # 7 ########################################################################### 2 8 3 9 use warnings; … … 7 13 8 14 # local classes 15 use czartool::Config; 9 16 use czartool::CzarDb; 10 17 use czartool::Gpc1Db; … … 17 24 18 25 my $period = 60; 19 my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc20 26 my $save_temps = 0; 21 27 22 28 GetOptions ( 23 29 "period|p=s" => \$period, # TODO more Db args 24 "dbname|d=s" => \$czarDbName,25 30 ); 26 31 27 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 28 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 32 my $config = new czartool::Config(); 33 my $czarDb = $config->getCzarDbInstance(); 34 my $gpc1Db = $config->getGpc1Instance; 29 35 my $nebulous = new czartool::Nebulous($czarDb); 30 36 my $pantasks = new czartool::Pantasks(); 31 my $plotter = czartool::Plotter->new_file($ gpc1Db, $czarDb, "/tmp", $save_temps);37 my $plotter = czartool::Plotter->new_file($config, "/tmp", $save_temps); 32 38 my $burntool = new czartool::Burntool(); 33 39 34 40 35 $czarDb->setDateFormat("%Y%m%d-%H%i%s");36 37 41 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); 38 42 39 43 40 44 timePoll($period); 45 46 ########################################################################### 47 # 48 # Updates the dates from pantasks for all interested servers 49 # 50 ########################################################################### 51 sub updateDates { 52 53 print "* Updating dates\n"; 54 my @servers = ("stdscience", "registration"); 55 56 my $server = undef; 57 $czarDb->emptyServerDates(); 58 foreach $server (@servers) { 59 60 my @dates = @{$pantasks->getDates($server)}; 61 if (@dates) { 62 63 $czarDb->updateServerDates($server, \@dates); 64 } 65 else { 66 67 print "WARNING: No dates to update for '$server'\n"; 68 } 69 } 70 } 41 71 42 72 ########################################################################### … … 55 85 my @labels = @{$pantasks->getLabels($server)}; 56 86 if (@labels) { 57 87 58 88 $czarDb->updateCurrentLabels($server, \@labels); 59 89 } 60 90 else { 61 62 print "WARNING: No labels to update for '$server'\n";91 92 print "WARNING: No labels to update for '$server'\n"; 63 93 } 64 94 } … … 110 140 my $today = undef; 111 141 my $yesterday = undef; 112 my $newDayTime = "18:00";142 my $newDayTime = $config->getMetricsStartTime(); 113 143 my $lastDayDailyTasks = "2010-01-01"; 114 144 … … 125 155 # if after 18:00 today, then perform some daily tasks and start plots from 18:00 today 126 156 else { 127 157 128 158 $begin = "$today $newDayTime"; 129 159 130 160 # check whether yesterday was cleaned. if not, cleanup tables and optimize 131 161 if ($lastDayDailyTasks ne $yesterday) { 132 162 133 163 print "* performing daily tasks (clean-up, metrics)"; 134 164 135 165 # create metrics for last 24 hours 136 166 print "* Creating metrics for last 24 hours\n"; 137 # TODO hardcoded path needs to be in config 138 my $dayMetrics = new czartool::DayMetrics($gpc1Db, 139 $czarDb, 140 "/data/ipp004.0/ipp/ippMetrics/", 141 1, 0, $today); 167 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $today); 142 168 $dayMetrics->writeHTML(); 143 169 144 170 # now update metrics index page 145 my $metricsIndex = new czartool::MetricsIndex($gpc1Db, 146 $czarDb, 147 "/data/ipp004.0/ipp/ippMetrics/", 148 1, 0); 171 my $metricsIndex = new czartool::MetricsIndex($config, 1, 0); 149 172 $metricsIndex->writeHTML(); 150 173 151 174 # now cleanup tables from yesterday and optimize 152 175 print "* New day - performing cleanup\n"; 153 $czarDb->cleanupDateRange($yesterday, $yesterday, "30 MINUTE");176 $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval()); 154 177 $czarDb->optimize(); 155 178 $lastDayDailyTasks = $yesterday; … … 167 190 $plotter->plotDiskUsageHistogram(); 168 191 updateServerStatus(); 192 193 # check pantasks dates 194 updateDates(); 169 195 170 196 # check labels -
branches/eam_branches/ipp-20101205/tools/czartool.pl
r28925 r30446 6 6 7 7 # local classes 8 use czartool::Config; 8 9 use czartool::CzarDb; 9 10 use czartool::Gpc1Db; … … 22 23 23 24 my @states = ("full", "new", "drop", "wait"); 24 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp"); 25 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 25 my $config = new czartool::Config(); 26 my $czarDb = $config->getCzarDbInstance(); 27 my $gpc1Db = $config->getGpc1Instance(); 26 28 my $pantasks = new czartool::Pantasks(); 27 $czarDb->setDateFormat("%Y%m%d-%H%i%s");28 29 29 30 my @stdscienceLabels = undef; -
branches/eam_branches/ipp-20101205/tools/czartool/CzarDb.pm
r29865 r30446 152 152 153 153 $query->execute; 154 } 155 156 ########################################################################### 157 # 158 # Cleans out server_dates table 159 # 160 ########################################################################### 161 sub emptyServerDates { 162 my ($self, $server, $dates) = @_; 163 164 my $query = $self->{_db}->prepare(<<SQL); 165 DELETE FROM server_dates; 166 SQL 167 168 $query->execute; 169 } 170 171 ########################################################################### 172 # 173 # Updates current_labels table 174 # 175 ########################################################################### 176 sub updateServerDates { 177 my ($self, $server, $dates) = @_; 178 179 my $size = scalar @{$dates}; 180 if ($size < 1) { return; } 181 182 my $date = undef; 183 184 foreach $date (@{$dates}) { 185 186 my $query = $self->{_db}->prepare(<<SQL); 187 INSERT INTO server_dates 188 (server, date) 189 VALUES 190 ('$server', '$date'); 191 SQL 192 193 $query->execute; 194 } 154 195 } 155 196 … … 1243 1284 elsif ($currentRevision == 10) {$self->createRevision_11();} 1244 1285 elsif ($currentRevision == 11) {$self->createRevision_12();} 1286 elsif ($currentRevision == 12) {$self->createRevision_13();} 1245 1287 else {last;} 1246 1288 } … … 1602 1644 # Create revision 12 of the database 1603 1645 # 1646 # - adding nightlyscience table 1647 # 1604 1648 ####################################################################################### 1605 1649 sub createRevision_12 { … … 1608 1652 print "* Creating revision 12 of '$self->{_dbName}'\n"; 1609 1653 1610 # same shape as other stage tables to enable easy update1611 1654 my $query = $self->{_db}->prepare(<<SQL); 1612 1655 CREATE TABLE nightlyscience ( … … 1619 1662 $self->setRevision(12); 1620 1663 } 1664 ####################################################################################### 1665 # 1666 # Create revision 13 of the database 1667 # 1668 # adding server_dates table 1669 # 1670 ####################################################################################### 1671 sub createRevision_13 { 1672 my ($self) = @_; 1673 1674 print "* Creating revision 13 of '$self->{_dbName}'\n"; 1675 1676 my $query = $self->{_db}->prepare(<<SQL); 1677 CREATE TABLE server_dates ( 1678 timestamp TIMESTAMP DEFAULT NOW(), 1679 server VARCHAR(64) DEFAULT "NONE", 1680 date VARCHAR(64) DEFAULT "NONE"); 1681 SQL 1682 1683 $query->execute; 1684 1685 $self->setRevision(13); 1686 } 1621 1687 1; 1622 1688 -
branches/eam_branches/ipp-20101205/tools/czartool/DayMetrics.pm
r30102 r30446 28 28 # Call the constructor of the parent class 29 29 my $self = $class->SUPER::new( 30 $_[1], # gpc1Db 31 $_[2], # czarDb 32 $_[3], # baseDir 33 $_[4], # verbose 34 $_[5] # save_temps 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 35 33 ); 36 34 37 $self->{day} = $_[ 6];35 $self->{day} = $_[4]; 38 36 39 37 my $yesterday = $self->{czarDb}->subtractInterval($self->{day}, "1 DAY"); 40 38 41 39 # sort out times 42 $self->{begin} = "$yesterday 18:00";40 $self->{begin} = "$yesterday " . $self->{config}->getMetricsStartTime(); 43 41 $self->{end} = $self->{czarDb}->addInterval($self->{begin}, "1 DAY"); 44 42 $self->{burntoolEnd} = $self->{czarDb}->addInterval($self->{begin}, "12 HOUR"); -
branches/eam_branches/ipp-20101205/tools/czartool/Metrics.pm
r30102 r30446 24 24 my $class = shift; 25 25 my $self = { 26 gpc1Db => shift, 27 czarDb => shift, 28 baseDir => shift, 26 config => shift, 29 27 verbose => shift, 30 28 save_temps => shift, 31 29 }; 30 31 $self->{gpc1Db} = $self->{config}->getGpc1Instance(); 32 $self->{czarDb} = $self->{config}->getCzarDbInstance(); 33 $self->{baseDir} = $self->{config}->getMetricsSaveLocation(); 32 34 33 35 # create path, dir … … 36 38 # instantiate a plotter object 37 39 $self->{plotter} = czartool::Plotter->new_file( 38 $self->{gpc1Db}, 39 $self->{czarDb}, 40 $self->{config}, 40 41 ".", 41 42 $self->{save_temps}); -
branches/eam_branches/ipp-20101205/tools/czartool/MetricsIndex.pm
r29859 r30446 28 28 # Call the constructor of the parent class 29 29 my $self = $class->SUPER::new( 30 $_[1], # gpc1Db 31 $_[2], # czarDb 32 $_[3], # baseDir 33 $_[4], # verbose 34 $_[5] # save_temps 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 35 33 ); 36 34 -
branches/eam_branches/ipp-20101205/tools/czartool/MultiDayMetrics.pm
r29860 r30446 28 28 # Call the constructor of the parent class 29 29 my $self = $class->SUPER::new( 30 $_[1], # gpc1Db 31 $_[2], # czarDb 32 $_[3], # baseDir 33 $_[4], # verbose 34 $_[5] # save_temps 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 35 33 ); 36 34 37 $self->{startDay} = $_[ 6];38 $self->{endDay} = $_[ 7];35 $self->{startDay} = $_[4]; 36 $self->{endDay} = $_[5]; 39 37 40 38 # sort out times 41 $self->{begin} = "$self->{startDay} 06:00";42 $self->{end} = "$self->{endDay} 06:00";39 $self->{begin} = "$self->{startDay} " . $self->{config}->getMetricsStartTime(); 40 $self->{end} = "$self->{endDay} " . $self->{config}->getMetricsStartTime(); 43 41 44 42 # create path, dir and html file -
branches/eam_branches/ipp-20101205/tools/czartool/Pantasks.pm
r29076 r30446 120 120 chomp($line); 121 121 if (!$self->outputOk($line)) {return \@labels;} 122 if ($line =~ m/pantasks:\s+/) {$passedHeader=1; next;} 123 if ($passedHeader) {push(@labels, $line);} 122 123 # sometimes a label can be on the same line as the panstasks prompt 124 if ($line =~ m/pantasks: (.*)/) { 125 $line = $1; 126 $passedHeader=1; 127 } 128 129 if ($passedHeader && length($line) > 0){push(@labels, $line);} 124 130 } 125 131 … … 191 197 } 192 198 } 199 200 ########################################################################### 201 # 202 # Gets current dates for this server 203 # 204 ########################################################################### 205 sub getDates { 206 my ($self, $server) = @_; 207 208 my @dates; 209 210 my $prefix; 211 212 if ($server eq "stdscience") {$prefix = "ns";} 213 elsif ($server eq "registration") {$prefix = "register";} 214 215 my @cmdOut = `echo "$prefix.show.dates;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`; 216 my $line; 217 my $passedHeader=0; 218 foreach $line (@cmdOut) { 219 220 chomp($line); 221 if (!$self->outputOk($line)) {return \@dates;} 222 223 # sometimes content is on same line as pantasks prompt 224 if ($line =~ m/pantasks: (.*)/) { 225 $line =~ s/pantasks: //; 226 $passedHeader=1; 227 } 228 229 if ($passedHeader && length($line) > 0){ 230 231 # strip out only the date part 232 if ($line =~ m/([0-9]{4}-[0-9]{2}-[0-9]{2}).*/) { 233 234 push(@dates, $1); 235 } 236 } 237 } 238 239 return \@dates; 240 } 241 242 193 243 1; -
branches/eam_branches/ipp-20101205/tools/czartool/Plotter.pm
r29951 r30446 7 7 8 8 use File::Temp; 9 10 use czartool::Config; 9 11 10 12 my @allStages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); … … 18 20 my $class = shift; 19 21 my $self = { 20 _gpc1Db => shift, 21 _czarDb => shift, 22 _config => shift, 22 23 _dateFormat => shift, 23 24 _outputFormat => shift, … … 27 28 28 29 bless $self, $class; 30 $self->init(); 29 31 return $self; 30 32 } … … 38 40 my $class = shift; 39 41 my $self = { 40 _gpc1Db => shift, 41 _czarDb => shift, 42 _config => shift, 42 43 _outputPath => shift, 43 44 _save_temps => shift, 44 45 }; 45 46 46 $self->{_dateFormat} = "%Y%m%d-%H%M%S"; 47 $self->{_outputFormat} = "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8"; # TODO path needs to be in config 48 49 bless $self, $class; 47 $self->{_outputFormat} = "png font \"".$self->{_config}->getGnuplotFont()."\" ".$self->{_config}->getGnuplotFontSize(); 48 49 bless $self, $class; 50 $self->init(); 50 51 return $self; 51 52 } … … 59 60 my $class = shift; 60 61 my $self = { 61 _gpc1Db => shift, 62 _czarDb => shift, 62 _config => shift, 63 63 _save_temps => shift, 64 64 }; … … 69 69 70 70 bless $self, $class; 71 $self->init(); 71 72 return $self; 72 73 } 73 74 74 75 ########################################################################### 76 # 77 # Some initialisation code common to all constructors 78 # 79 ########################################################################### 80 sub init { 81 my ($self) = @_; 82 83 $self->{_gpc1Db} = $self->{_config}->getGpc1Instance(); 84 $self->{_czarDb} = $self->{_config}->getCzarDbInstance(); 85 } 75 86 76 87 ########################################################################### … … 508 519 GP->autoflush(1); 509 520 521 my $datFile = $tmpFile->filename; 510 522 if ($self->{_outputFormat} ne "X11") {print GP "set output \"$outputFile\";";} 511 print GP 512 "set term $self->{_outputFormat};" .513 "set title \"Total available cluster space over time\\nFrom $fromTime to $toTime HST\";" .514 "set key left top;" .515 "set xdata time;" .516 "set timefmt \"$self->{_dateFormat}\";" .517 "set format x \"$timeFormat\";" .518 "set xtics \"$minX\", $divX, \"$maxX\";" .519 "set grid xtics;" .520 "set xlabel \"Time\";" .521 "set ylabel \"Available (TB)\";" .522 "plot " .523 "'".$tmpFile->filename."' using 1:2 title \"Available\" with lines lt 2 lw 2\n"; 523 print GP <<PLOT; 524 set term $self->{_outputFormat} 525 set title "Total available cluster space over time\\nFrom $fromTime to $toTime HST" 526 set key left top 527 set xdata time 528 set timefmt "$self->{_dateFormat}" 529 set format x "$timeFormat" 530 set xtics "$minX", $divX, "$maxX" 531 set grid xtics 532 set xlabel "Time" 533 set ylabel "Available (TB)" 534 plot "$datFile" using 1:2 title "Available" with lines lt 2 lw 2 535 PLOT 524 536 525 537 print GP "\n"; -
branches/eam_branches/ipp-20101205/tools/roboczar.pl
r29804 r30446 7 7 8 8 # local classes 9 use czartool::Config; 9 10 use czartool::CzarDb; 10 11 use czartool::Gpc1Db; … … 15 16 use czartool::StageMetrics; 16 17 17 my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc18 18 my $save_temps = 0; 19 19 20 GetOptions ( 21 "dbname|d=s" => \$czarDbName, 22 ); 23 24 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 25 26 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 20 my $config = new czartool::Config(); 21 my $czarDb = $config->getCzarDbInstance(); 27 22 28 23 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); # TODO get from Pantasks … … 41 36 $message = ""; 42 37 43 if (anyStoppedServers( "20 MINUTE", \$serversMessage)) {38 if (anyStoppedServers($config->getRoboczarServerInterval(), \$serversMessage)) { 44 39 45 40 $message .= "\n\n" . $serversMessage; 46 41 $anythingToReport = 1; 47 42 } 48 if (anyStuckStages("2 HOUR", \$stuckMessage)) {43 # if (anyStuckStages("2 HOUR", \$stuckMessage)) { 49 44 50 $message .= "\n\n" . $stuckMessage;51 $anythingToReport = 1;52 }45 # $message .= "\n\n" . $stuckMessage; 46 # $anythingToReport = 1; 47 # } 53 48 54 49 if ($anythingToReport && $message ne $lastMessage) { … … 56 51 print "\n\n$message\n\n"; 57 52 58 sendEmail( 59 "ps-ipp-ops\@ifa.hawaii.edu", 53 sendEmail($config->getRoboczarEmail(), 60 54 "Roboczar warnings", 61 55 "$message\n"); … … 82 76 my $anyStuckStages = 0; 83 77 84 # exception - we don't care if burntool is stalled before 6:30am 78 # exception - we don't care if burntool is stalled before 6:30am TODO we do now 85 79 my $burntime = strftime('%Y-%m-%d 06:35', localtime); 86 80 my $worryAboutBurntool = $czarDb->isBefore($burntime, $end);
Note:
See TracChangeset
for help on using the changeset viewer.
