Changeset 30579
- Timestamp:
- Feb 11, 2011, 2:49:34 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205
- Files:
-
- 1 deleted
- 55 edited
- 49 copied
-
ippMonitor/Makefile.in (modified) (4 diffs)
-
ippMonitor/def/addRunProcessed.d (copied) (copied from trunk/ippMonitor/def/addRunProcessed.d )
-
ippMonitor/def/addRunRun.d (copied) (copied from trunk/ippMonitor/def/addRunRun.d )
-
ippMonitor/def/diffProcessedSkyfile_Images.d (modified) (1 diff)
-
ippMonitor/def/magicProcessedMasks_Images.d (modified) (2 diffs)
-
ippMonitor/def/minidvodbCopy.d (copied) (copied from trunk/ippMonitor/def/minidvodbCopy.d )
-
ippMonitor/def/minidvodbProcessed.d (copied) (copied from trunk/ippMonitor/def/minidvodbProcessed.d )
-
ippMonitor/def/minidvodbRun.d (copied) (copied from trunk/ippMonitor/def/minidvodbRun.d )
-
ippMonitor/def/rawBurntoolState.d (copied) (copied from trunk/ippMonitor/def/rawBurntoolState.d )
-
ippMonitor/raw/czartool_exposures.php (modified) (5 diffs)
-
ippMonitor/raw/ipp.dvodb.dat (copied) (copied from trunk/ippMonitor/raw/ipp.dvodb.dat )
-
ippMonitor/raw/ipp.dvodb.php (copied) (copied from trunk/ippMonitor/raw/ipp.dvodb.php )
-
ippMonitor/raw/ipp.load.dat (modified) (1 diff)
-
ippMonitor/raw/ipp.menu.dat (modified) (1 diff)
-
ippMonitor/raw/ipp.php (modified) (2 diffs)
-
ippMonitor/scripts/generate (modified) (1 diff)
-
ippScripts/scripts/chip_imfile.pl (modified) (1 diff)
-
ippScripts/scripts/dist_advancerun.pl (modified) (8 diffs)
-
ippScripts/scripts/dist_bundle.pl (modified) (8 diffs)
-
ippScripts/scripts/dist_component.pl (modified) (5 diffs)
-
ippScripts/scripts/dist_defineruns.pl (modified) (4 diffs)
-
ippScripts/scripts/dist_make_fileset.pl (modified) (3 diffs)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (6 diffs)
-
ippScripts/scripts/magic_destreak_cleanup.pl (modified) (4 diffs)
-
ippScripts/scripts/nightly_science.pl (modified) (3 diffs)
-
ippScripts/scripts/register_exp.pl (modified) (3 diffs)
-
ippScripts/scripts/warp_skycell.pl (modified) (9 diffs)
-
ippTasks/diskbalance.pro (modified) (1 diff)
-
ippTasks/dist.pro (modified) (6 diffs)
-
ippTasks/pstamp.pro (modified) (9 diffs)
-
ippTasks/rcserver.pro (modified) (3 diffs)
-
ippTasks/register.pro (modified) (5 diffs)
-
ippTasks/survey.pro (modified) (4 diffs)
-
ippToPsps/perl/ippToPsps/Gpc1Db.pm (modified) (1 diff)
-
ippToPsps/perl/utest (copied) (copied from trunk/ippToPsps/perl/utest )
-
ippToPsps/perl/utest/00230033.FITS.CORRECT (copied) (copied from trunk/ippToPsps/perl/utest/00230033.FITS.CORRECT )
-
ippToPsps/perl/utest/ippToPsps_inputFileList (copied) (copied from trunk/ippToPsps/perl/utest/ippToPsps_inputFileList )
-
ippToPsps/perl/utest/results.correct (copied) (copied from trunk/ippToPsps/perl/utest/results.correct )
-
ippToPsps/perl/utest/run.sh (copied) (copied from trunk/ippToPsps/perl/utest/run.sh )
-
ippTools/share/camtool_find_pendingimfile.sql (modified) (1 prop)
-
ippTools/share/chiptool_processedimfile.sql (modified) (2 diffs)
-
ippTools/share/difftool_pendingcleanupskyfile.sql (modified) (1 diff)
-
ippTools/share/difftool_setskyfiletoupdate.sql (modified) (1 diff)
-
ippTools/share/magicdstool_setfiletoupdate.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 prop)
-
ippTools/share/regtool_pendingexp.sql (modified) (1 diff)
-
ippTools/share/warptool_change_skyfile_data_state.sql (modified) (1 diff)
-
ippTools/share/warptool_scmap.sql (modified) (1 diff)
-
ippTools/share/warptool_setskyfiletoupdate.sql (modified) (1 diff)
-
ippTools/share/warptool_towarped.sql (modified) (3 diffs)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/chiptool.c (modified) (3 diffs)
-
ippTools/src/difftool.c (modified) (3 diffs)
-
ippTools/src/disttool.c (modified) (1 diff)
-
ippTools/src/disttoolConfig.c (modified) (1 diff)
-
ippTools/src/dqstatstool.c (modified) (6 diffs)
-
ippTools/src/magicdstool.c (modified) (4 diffs)
-
ippTools/src/magictool.c (modified) (1 diff, 1 prop)
-
ippTools/src/magictoolConfig.c (modified) (1 diff)
-
ippTools/src/pstamptool.c (modified) (2 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff)
-
ippTools/src/pxtools.h (modified) (1 diff)
-
ippTools/src/warptool.c (modified) (6 diffs)
-
pstamp/scripts/Makefile.am (modified) (1 diff)
-
pstamp/scripts/psstatus (copied) (copied from trunk/pstamp/scripts/psstatus )
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (23 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (6 diffs)
-
pstamp/scripts/pstamp_save_server_status.pl (copied) (copied from trunk/pstamp/scripts/pstamp_save_server_status.pl )
-
pstamp/scripts/pstamp_server_status (modified) (3 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (1 diff)
-
tools/log_parsing (copied) (copied from trunk/tools/log_parsing )
-
tools/log_parsing/README (copied) (copied from trunk/tools/log_parsing/README )
-
tools/log_parsing/data (copied) (copied from trunk/tools/log_parsing/data )
-
tools/log_parsing/data/performance (copied) (copied from trunk/tools/log_parsing/data/performance )
-
tools/log_parsing/data/performance/access_log-100k.gz (copied) (copied from trunk/tools/log_parsing/data/performance/access_log-100k.gz )
-
tools/log_parsing/data/unittests (copied) (copied from trunk/tools/log_parsing/data/unittests )
-
tools/log_parsing/data/unittests/expectations (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations )
-
tools/log_parsing/data/unittests/expectations/log.create.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.create.pl )
-
tools/log_parsing/data/unittests/expectations/log.create.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.create.py )
-
tools/log_parsing/data/unittests/expectations/log.delete.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.delete.pl )
-
tools/log_parsing/data/unittests/expectations/log.delete.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.delete.py )
-
tools/log_parsing/data/unittests/expectations/log.failure_stat.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.failure_stat.pl )
-
tools/log_parsing/data/unittests/expectations/log.failure_stat.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.failure_stat.py )
-
tools/log_parsing/data/unittests/expectations/log.find_instance.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.find_instance.pl )
-
tools/log_parsing/data/unittests/expectations/log.find_instance.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.find_instance.py )
-
tools/log_parsing/data/unittests/expectations/log.non_nebulous.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.non_nebulous.pl )
-
tools/log_parsing/data/unittests/expectations/log.non_nebulous.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.non_nebulous.py )
-
tools/log_parsing/data/unittests/expectations/log.stat.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.stat.pl )
-
tools/log_parsing/data/unittests/expectations/log.stat.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.stat.py )
-
tools/log_parsing/data/unittests/expectations/log.unknown.pl (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.unknown.pl )
-
tools/log_parsing/data/unittests/expectations/log.unknown.py (copied) (copied from trunk/tools/log_parsing/data/unittests/expectations/log.unknown.py )
-
tools/log_parsing/data/unittests/input (copied) (copied from trunk/tools/log_parsing/data/unittests/input )
-
tools/log_parsing/data/unittests/input/log.create (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.create )
-
tools/log_parsing/data/unittests/input/log.delete (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.delete )
-
tools/log_parsing/data/unittests/input/log.failure_stat (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.failure_stat )
-
tools/log_parsing/data/unittests/input/log.find_instance (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.find_instance )
-
tools/log_parsing/data/unittests/input/log.non_nebulous (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.non_nebulous )
-
tools/log_parsing/data/unittests/input/log.stat (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.stat )
-
tools/log_parsing/data/unittests/input/log.unknown (copied) (copied from trunk/tools/log_parsing/data/unittests/input/log.unknown )
-
tools/log_parsing/parse_apache_log.pl (copied) (copied from trunk/tools/log_parsing/parse_apache_log.pl )
-
tools/log_parsing/parse_apache_log.py (copied) (copied from trunk/tools/log_parsing/parse_apache_log.py )
-
tools/log_parsing/runUnitTests.sh (copied) (copied from trunk/tools/log_parsing/runUnitTests.sh )
-
tools/parse_apache_log.pl (copied) (copied from trunk/tools/parse_apache_log.pl )
-
tools/parse_nebulous_logs.pl (copied) (copied from trunk/tools/parse_nebulous_logs.pl )
-
tools/psstatus (deleted)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/ippMonitor/Makefile.in
r30446 r30579 43 43 $(DESTWWW)/ipp.stack.dat \ 44 44 $(DESTWWW)/ipp.stack.php \ 45 $(DESTWWW)/ipp.dvodb.dat \ 46 $(DESTWWW)/ipp.dvodb.php \ 45 47 $(DESTWWW)/phptest.php \ 46 48 $(DESTWWW)/site.php \ … … 59 61 $(DESTWWW)/show_and_delete_image.php \ 60 62 $(DESTWWW)/scatterPlot.php \ 63 $(DESTWWW)/rawBurntoolState.php \ 61 64 $(DESTWWW)/plotHistogram.php \ 62 65 $(DESTWWW)/columns_in_db.php \ … … 65 68 $(DESTWWW)/warpProcessedExp.php \ 66 69 $(DESTWWW)/diskUsage.php \ 67 $(DESTWWW)/version.php 70 $(DESTWWW)/version.php 71 72 73 68 74 69 75 DEFSRC = \ … … 211 217 $(DESTWWW)/exposureStatus.php \ 212 218 $(DESTWWW)/mopsStatus.php \ 213 $(DESTWWW)/gpc1MysqlProcessList.php 219 $(DESTWWW)/gpc1MysqlProcessList.php \ 220 $(DESTWWW)/minidvodbRun.php \ 221 $(DESTWWW)/minidvodbCopy.php \ 222 $(DESTWWW)/minidvodbProcessed.php \ 223 $(DESTWWW)/addRunRun.php \ 224 $(DESTWWW)/addRunProcessed.php 225 226 214 227 215 228 PICTURES = \ -
branches/eam_branches/ipp-20101205/ippMonitor/def/diffProcessedSkyfile_Images.d
r27892 r30579 11 11 # IMAGE VAR basename filerule camera class_id 12 12 IMAGE JPEG2 $diffSkyfile.path_base PPSUB.OUTPUT.JPEG2 GPC1 NONE 13 14 # if no query restrictions are supplied, we want to limit the query or it is extremely long running: 15 UNRESTRICTED AND diffRun.diff_id = 0 13 16 14 17 # XXX need to get camera from lookup -
branches/eam_branches/ipp-20101205/ippMonitor/def/magicProcessedMasks_Images.d
r27892 r30579 11 11 ARGS ARG7 magicRun.magic_id=$magicRun.magic_id 12 12 ARGS ARG7 camera=GPC1 13 ARGS ARG7 basename=$magicRun.workdir/$magicRun.exp_id/$magicRun.exp_id.mgc.$magicRun.magic_id.verify/$magicRun.exp_id 13 #ARGS ARG7 basename=$magicRun.workdir/$magicRun.exp_id/$magicRun.exp_id.mgc.$magicRun.magic_id.verify/$magicRun.exp_id 14 ARGS ARG7 basename=$magicMask.path_base 14 15 15 16 # field size format name show link to extras … … 25 26 FIELD magicMask.fault, 5, %d, Fault 26 27 FIELD magicRun.workdir, 5, %s, Label, none 28 FIELD magicMask.path_base, 5, %s, Label, none 27 29 28 30 TAIL PHP insert_image ('MAGIC.ORIGINAL.PNG', 'width=49%'); -
branches/eam_branches/ipp-20101205/ippMonitor/raw/czartool_exposures.php
r30446 r30579 17 17 else {$myMenu = "ipp.imfiles.dat";} 18 18 19 menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']);20 21 19 $pass = $ID['pass']; 22 20 $proj = $ID['proj']; 23 21 $menu = $ID['menu']; 24 22 25 $today = date("Y-m-d"); 26 23 $date = $_POST['date']; 24 $survey = $_POST['survey']; 25 26 // if no date chosen, use today 27 if ($date == "") $date = date("Y-m-d"); 28 if ($survey == "") $survey = ""; 29 30 menu($myMenu, 'Exposure summary for '.$date , 'ipp.css', $ID['link'], $ID['proj']); 31 32 // set up the form 33 echo "<form action=\"czartool_exposures.php\" method=\"POST\">\n"; 34 35 echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n"; 36 echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n"; 37 echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n"; 38 39 40 echo "<form method=post action=czartool_exposures.php?pass=$pass&proj=$proj&date=$date&survey=$survey>"; 41 echo "<p align=\"center\"> Current status of all exposures taken on (UTC) <input type=text name=date value='$date'>"; 42 echo " for survey <input type=text name=survey value='$survey'> (leave blank for all surveys)"; 43 echo "<input type=submit value=Submit>"; 27 44 echo "</p>"; 28 echo "<p align=\"center\"> Current status of all exposures taken $today UTC </p>"; 29 30 createTableForThisSurvey($gpc1db, $today, ""); 45 46 echo "</form>\n"; 47 48 createTableForThisSurvey($gpc1db, $date, $survey); 31 49 32 50 menu_end(); … … 58 76 $qry->fetchInto($count); 59 77 60 if ($surveyStr == "") $surveyText = "all surveys"; 78 if ($surveyStr == "") $surveyText = "all surveys"; 61 79 else $surveyText = "$surveyStr survey"; 62 80 … … 83 101 $ssDiffProduced = array(); getSSDiffProduced($db, $date, $surveyStr, &$ssDiffProduced); 84 102 85 $class = "list"; 86 echo "<table class=$class >\n"; 103 // create table 104 echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 105 106 // table headers 87 107 echo "<tr><td></td>\n"; 88 write_header_cell($class, "");89 write_header_cell($class, "");90 write_header_cell($class, "");91 write_header_cell($class, "");92 write_header_cell($class, "Raw");93 write_header_cell($class, "Chip");94 write_header_cell($class, "Camera");95 write_header_cell($class, "Warp");96 write_header_cell($class, "Stack");97 write_header_cell($class, "Warp-Stack Diff");98 write_header_cell($class, "Warp-Warp1 Diff");99 write_header_cell($class, "Warp-Warp2 Diff");100 write_header_cell($class, "Stack-Stack Diff");108 echo "<th></th>"; 109 echo "<th></th>"; 110 echo "<th></th>"; 111 echo "<th></th>"; 112 echo "<th>Raw</th>"; 113 echo "<th>Chip</th>"; 114 echo "<th>Camera</th>"; 115 echo "<th>Warp</th>"; 116 echo "<th>Stack</th>"; 117 echo "<th>Warp-Stack Diff</th>"; 118 echo "<th>Warp-Warp1 Diff</th>"; 119 echo "<th>Warp-Warp2 Diff</th>"; 120 echo "<th>Stack-Stack Diff</th>"; 101 121 echo "<tr><td></td>\n"; 102 write_header_cell($class, "Exp ID");103 write_header_cell($class, "Exp Name");104 write_header_cell($class, "Filter");105 write_header_cell($class, "Comment");106 write_header_cell($class, "state");107 write_header_cell($class, "state/dist?");108 write_header_cell($class, "state/dist?");109 write_header_cell($class, "state/dist?");110 write_header_cell($class, "total/dist");111 write_header_cell($class, "total/dist");112 write_header_cell($class, "total/dist");113 write_header_cell($class, "total/dist");114 write_header_cell($class, "total/dist");122 echo "<th>Exp ID</th>"; 123 echo "<th>Exp Name</th>"; 124 echo "<th>Filter</th>"; 125 echo "<th>Comment</th>"; 126 echo "<th>state</th>"; 127 echo "<th>state/dist?</th>"; 128 echo "<th>state/dist?</th>"; 129 echo "<th>state/dist?</th>"; 130 echo "<th>total/dist</th>"; 131 echo "<th>total/dist</th>"; 132 echo "<th>total/dist</th>"; 133 echo "<th>total/dist</th>"; 134 echo "<th>total/dist</th>"; 115 135 116 136 $sql = … … 147 167 echo "<tr><td></td>\n"; 148 168 169 echo "<TD>$exp_id</td>"; 170 echo "<TD>$exp_name</td>"; 171 echo "<TD>$filter</td>"; 172 echo "<TD>$comment</td>"; 173 echo "<TD>$rawExp</td>"; 174 149 175 // chip 150 176 if (!$chipDist[$exp_id]) $chipDistStr = "N"; 151 177 else $chipDistStr = $chipDist[$exp_id]; 178 echo "<TD>$chipState/$chipDistStr</td>"; 152 179 153 180 // cam 154 181 if (!$camDist[$exp_id]) $camDistStr = "N"; 155 182 else $camDistStr = $camDist[$exp_id]; 183 echo "<TD>$camState/$camDistStr</td>"; 156 184 157 185 // warp 158 186 if (!$warpDist[$exp_id]) $warpDistStr = "N"; 159 187 else $warpDistStr = $warpDist[$exp_id]; 188 echo "<TD>$warpState/$warpDistStr</td>"; 160 189 161 190 // stack 162 if (!$stack_hash[$exp_id] && !$stackDist[$exp_id]) $stackDistStr = " ";191 if (!$stack_hash[$exp_id] && !$stackDist[$exp_id]) $stackDistStr = " "; 163 192 else $stackDistStr = $stack_hash[$exp_id] . "/" . $stackDist[$exp_id]; 193 $color = getColour($stack_hash[$exp_id], $stackDist[$exp_id]); 194 echo "<TD bgcolor=\"$color\" >$stackDistStr</td>"; 164 195 165 196 // WS diff 166 if (!$wsDiffProduced[$exp_id] && !$wsDiffDist[$exp_id]) $wsDistStr = " ";197 if (!$wsDiffProduced[$exp_id] && !$wsDiffDist[$exp_id]) $wsDistStr = " "; 167 198 else $wsDistStr = $wsDiffProduced[$exp_id] . "/" . $wsDiffDist[$exp_id]; 199 $color = getColour($wsDiffProduced[$exp_id], $wsDiffDist[$exp_id]); 200 echo "<TD bgcolor=\"$color\" >$wsDistStr</td>"; 168 201 169 202 // WW1 diff 170 if (!$ww1DiffProduced[$exp_id] && !$ww1DiffDist[$exp_id]) $ww1DistStr = " ";203 if (!$ww1DiffProduced[$exp_id] && !$ww1DiffDist[$exp_id]) $ww1DistStr = " "; 171 204 else $ww1DistStr = $ww1DiffProduced[$exp_id] . "/" . $ww1DiffDist[$exp_id]; 205 $color = getColour($ww1DiffProduced[$exp_id], $ww1DiffDist[$exp_id]); 206 echo "<TD bgcolor=\"$color\" >$ww1DistStr</td>"; 172 207 173 208 // WW2 dist 174 if (!$ww2DiffProduced[$exp_id] && !$ww2DiffDist[$exp_id]) $ww2DistStr = " ";209 if (!$ww2DiffProduced[$exp_id] && !$ww2DiffDist[$exp_id]) $ww2DistStr = " "; 175 210 else $ww2DistStr = $ww2DiffProduced[$exp_id] . "/" . $ww2DiffDist[$exp_id]; 211 $color = getColour($ww2DiffProduced[$exp_id], $ww2DiffDist[$exp_id]); 212 echo "<TD bgcolor=\"$color\" >$ww2DistStr</td>"; 176 213 177 214 // SS dist 178 if (!$ssDiffProduced[$exp_id] && !$ssDiffDist[$exp_id]) $ssDistStr = " ";215 if (!$ssDiffProduced[$exp_id] && !$ssDiffDist[$exp_id]) $ssDistStr = " "; 179 216 else $ssDistStr = $ssDiffProduced[$exp_id] . "/" . $ssDiffDist[$exp_id]; 180 181 write_table_cell($class, '%s', "", $exp_id); 182 write_table_cell($class, '%s', "", $exp_name); 183 write_table_cell($class, '%s', "", $filter); 184 write_table_cell($class, '%s', "", $comment); 185 write_table_cell($class, '%s', "", $rawExp); 186 write_table_cell($class, '%s', "", "$chipState/$chipDistStr"); 187 write_table_cell($class, '%s', "", "$camState/$camDistStr"); 188 write_table_cell($class, '%s', "", "$warpState/$warpDistStr"); 189 write_table_cell($class, '%s', "", $stackDistStr); 190 write_table_cell($class, '%s', "", $wsDistStr); 191 write_table_cell($class, '%s', "", $ww1DistStr); 192 write_table_cell($class, '%s', "", $ww2DistStr); 193 write_table_cell($class, '%s', "", $ssDistStr); 217 $color = getColour($ssDiffProduced[$exp_id], $ssDiffDist[$exp_id]); 218 echo "<TD bgcolor=\"$color\" >$ssDistStr</td>"; 194 219 195 220 echo "</tr>\n"; … … 199 224 } 200 225 226 ########################################################################### 227 # 228 # Gets the right cell colour provided number created and distributed 229 # 230 ########################################################################### 231 function getColour($created, $distributed) { 232 233 if ($distributed > 0 && $created > 0 && $distributed % $created != 0) return "red"; 234 return ""; 235 } 201 236 202 237 ########################################################################### -
branches/eam_branches/ipp-20101205/ippMonitor/raw/ipp.load.dat
r28451 r30579 23 23 menulink | menuselect | link | New Imfile | newImfile.php 24 24 menulink | menuselect | link | Raw Imfile | rawImfile.php 25 menutop | menutop | plain | | 26 menulink | menuselect | link | Burntool State | rawBurntoolState.php -
branches/eam_branches/ipp-20101205/ippMonitor/raw/ipp.menu.dat
r28601 r30579 23 23 menutop | menutop | link | Stack Steps | ipp.stack.php 24 24 menutop | menutop | link | Distribution | ipp.dist.php 25 menutop | menutop | link | dvoDB | ipp.dvodb.php 25 26 menutop | menutop | link | Calibration | ipp.cal.php 26 27 menutop | menutop | link | Plots | ipp.plots.php -
branches/eam_branches/ipp-20101205/ippMonitor/raw/ipp.php
r28688 r30579 390 390 if ($sortKey == "") { 391 391 if ($_SERVER[REQUEST_METHOD] == 'GET') { 392 $sort Key= $_GET['rsort'];392 $sortVal = $_GET['rsort']; 393 393 } else { 394 $sort Key= $_POST['rsort'];394 $sortVal = $_POST['rsort']; 395 395 } 396 396 if ($sortVal != "") { … … 529 529 $value = $_POST[$htmlkey]; 530 530 } 531 # a search restriction may include an SQL wild-card. we have to mangle these so that the http 532 # does not get converted to a special character 533 $value = preg_replace ('|%|', '%25', $value); 531 534 if ($value != "") { 532 535 if ($line) { -
branches/eam_branches/ipp-20101205/ippMonitor/scripts/generate
r29485 r30579 58 58 if ($key eq "FIELD") { 59 59 ($field, $width, $format, $name, $show, $link, $extras) = split (/,\s+/, $value, 7); 60 if (! $name) { die "table $ARGV[0] missing required elements \n"; }60 if (! $name) { die "table $ARGV[0] missing required elements: $value\n"; } 61 61 if ($field =~ m|\S+\s+as\s+\S+|) { 62 62 ($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/chip_imfile.pl
r30102 r30579 325 325 # get the UNIX version of the (possible) neb: or path: filename 326 326 my $uriReal = $ipprc->file_resolve( $uri ); 327 &my_die("Unable to resolve $uri on $host", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) if !$uriReal; 327 328 328 329 # funpack into the temp file. -
branches/eam_branches/ipp-20101205/ippScripts/scripts/dist_advancerun.pl
r28963 r30579 23 23 use PS::IPP::Config 1.01 qw( :standard ); 24 24 25 my $ipprc = PS::IPP::Config->new(); # IPP configuration26 25 27 26 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 29 28 30 29 # Parse the command-line arguments 31 my ($dist_id, $stage, $stage_id, $outdir, $clean );30 my ($dist_id, $stage, $stage_id, $outdir, $clean, $camera); 32 31 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 33 32 34 33 GetOptions( 35 'dist_id=s' => \$dist_id,# Magic destreak run identifier 34 'dist_id=s' => \$dist_id,# Magic destreak run identifier 35 'camera=s' => \$camera, 36 36 'stage=s' => \$stage, # raw, chip, warp, or diff 37 37 'stage_id=s' => \$stage_id, # exp_id, chip_id, warp_id, or diff_id … … 53 53 defined $stage_id and 54 54 defined $outdir; 55 56 my $ipprc = PS::IPP::Config->new($camera); # IPP configuration 55 57 56 58 $ipprc->redirect_output($logfile) if $logfile; … … 134 136 } 135 137 136 # XXX should we create a file rule for this? 137 my $dbinfo_file = "$outdir/dbinfo.$stage.$stage_id.mdc"; 138 139 { 140 my $command = "$tool_cmd $exportarg -outfile $dbinfo_file"; 138 139 # work around the fact that $ipprc->file_create does not actually create a file on disk 140 # unless the scheme is nebulous 141 sub create_file { 142 my $rule = shift; 143 my $path_base = shift; 144 my $ref = shift; 145 146 my $file; 147 148 my $error; 149 $file = $ipprc->prepare_output($rule, $path_base, undef, 1, \$error) 150 or &my_die("Unable to prepare outut for $rule", $dist_id, $PS_EXIT_SYS_ERROR); 151 152 my $scheme = file_scheme($file); 153 $scheme = "" if !$scheme; 154 155 my $resolved; 156 if ($scheme) { 157 $ipprc->file_create($file) 158 or &my_die("Unable to create $file", $dist_id, $PS_EXIT_SYS_ERROR); 159 160 $resolved = $ipprc->file_resolve($file) 161 or &my_die("Unable to resolve $file", $dist_id, $PS_EXIT_SYS_ERROR); 162 163 if ($scheme eq 'neb') { 164 &my_die("$resolved not found", $dist_id, $PS_EXIT_SYS_ERROR) unless ($resolved and -e $resolved); 165 } 166 } else { 167 $resolved = $file; 168 } 169 $$ref = $resolved; 170 171 return $file 172 } 173 174 my $dbinfo_root = "$outdir/dbinfo.$stage.$stage_id"; 175 my $resolved; 176 my $dbinfo_file = create_file("DIST.OUTPUT.DBINFO", $dbinfo_root, \$resolved); 177 178 { 179 my $command = "$tool_cmd $exportarg -outfile $resolved"; 141 180 $command .= " -clean" if ((defined $clean) and ($stage ne "raw")); 142 181 $command .= " -dbname $dbname" if defined $dbname; … … 149 188 } 150 189 } 151 my $dirinfo = "$outdir/dirinfo.$stage.$stage_id.mdc"; 190 191 my $dirinfo_root = "$outdir/dirinfo.$stage.$stage_id"; 192 my $dirinfo = create_file("DIST.OUTPUT.DIRINFO", $dirinfo_root, \$resolved); 193 152 194 { 153 195 my $command = "$tool_cmd $list_mode"; … … 168 210 &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR); 169 211 170 open MANIFEST, ">$ dirinfo" or171 &my_die("Unable to open dirinfo file $ dirinfo", $dist_id, $PS_EXIT_UNKNOWN_ERROR);212 open MANIFEST, ">$resolved" or 213 &my_die("Unable to open dirinfo file $resolved", $dist_id, $PS_EXIT_UNKNOWN_ERROR); 172 214 173 215 my $destdir; … … 197 239 &my_die("unable to find path", $dist_id, $PS_EXIT_UNKNOWN_ERROR) if !$path; 198 240 my $component_dir = find_componentdir($destdir, $path); 199 # print MANIFEST "$component METADATA\n";200 241 print MANIFEST "\t" , "$component", "\tSTR\t", $component_dir, "\n"; 201 242 } … … 217 258 } 218 259 } 219 220 260 221 261 exit 0; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/dist_bundle.pl
r30102 r30579 16 16 17 17 use IPC::Cmd 0.36 qw( can_run run ); 18 use File::Temp qw( tempfile );18 use File::Temp qw( tempfile tempdir ); 19 19 use File::Basename qw( basename ); 20 20 use Digest::MD5::File qw( file_md5_hex ); … … 71 71 # Parse the command-line arguments 72 72 my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $alt_path_base, $clean); 73 my ($out dir, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file, $prefix);73 my ($outroot, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file, $prefix); 74 74 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 75 75 … … 88 88 'magicked' => \$magicked, # magicked state for this component 89 89 'alt_path_base=s'=> \$alt_path_base, # path to alternate inputs 90 'out dir=s' => \$outdir, # "directory" for outputs90 'outroot=s' => \$outroot, # outroot 91 91 'prefix=s' => \$prefix, # "prefix" to apply to filenames 92 92 'clean' => \$clean, # create clean distribution … … 99 99 100 100 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 101 pod2usage( -msg => "Required options: --camera --stage --stage_id --component --path_base --out dir",101 pod2usage( -msg => "Required options: --camera --stage --stage_id --component --path_base --outroot", 102 102 -exitval => 3) unless 103 103 defined $camera and … … 106 106 defined $component and 107 107 defined $path_base and 108 defined $out dir;108 defined $outroot; 109 109 110 110 $ipprc->redirect_output($logfile) if $logfile; … … 116 116 $ipprc->define_camera($camera); 117 117 118 # create the output directories if it is not a nebulous path and it doesn't exist 119 if (index($outdir, "neb://") != 0) { 120 if (! -e $outdir ) { 121 my $code = system "mkdir -p $outdir"; 122 &my_die("cannot create output directory $outdir", $component, 123 $code >> 8) if $code; 124 } 125 } 118 $ipprc->outroot_prepare($outroot); 126 119 127 120 # Get the list of data products for this component … … 138 131 # set up directory for temporary files 139 132 140 my $tmpdir = "$outdir/tmpdir.$component.$$"; 141 if (-e $tmpdir) { 142 if (-d $tmpdir) { 143 my $rc = system "rm -r $tmpdir"; 144 &my_die("cannot rm $tmpdir return code: $rc", $component, $PS_EXIT_UNKNOWN_ERROR) if $rc; 145 } else { 146 unlink $tmpdir or &my_die("cannot delete $tmpdir", $component, $PS_EXIT_UNKNOWN_ERROR); 147 } 148 } 149 mkdir $tmpdir or &my_die("cannot create temporary directory $tmpdir", $component, 150 $PS_EXIT_UNKNOWN_ERROR); 133 my $temproot = metadataLookupStr($ipprc->{_siteConfig}, "TEMP.DIR"); 134 $temproot = "/tmp" if !defined $temproot; 135 &my_die("directory for TEMP.DIR $temproot does not exist", $component, $PS_EXIT_CONFIG_ERROR) if ! -e $temproot; 136 137 my $tmpdir = tempdir("$temproot/dist.XXXX", CLEANUP => !$save_temps); 151 138 152 139 # … … 349 336 if ($num_files) { 350 337 # create the tarfile 351 # XXX TODO: create a file rule for the tar file name 352 my $tbase = basename($path_base); 353 $tbase .= ".$component" if $component; 354 $file_name = ($prefix ? $prefix : "") . "$tbase.tgz"; 355 my $tarfile = "$outdir/$file_name"; 338 # my $tbase = basename($path_base); 339 # $tbase .= ".$component" if $component; 340 # $file_name = ($prefix ? $prefix : "") . "$tbase.tgz"; 341 my $error; 342 my $output_tarfile; 343 my $rule; 344 if ($stage eq 'chip' or $stage eq 'chip_bg' or $stage eq 'raw') { 345 $rule = "DIST.OUTPUT.CHIP.BUNDLE"; 346 } else { 347 $rule = "DIST.OUTPUT.BUNDLE"; 348 } 349 $output_tarfile = $ipprc->prepare_output($rule, $outroot, $component, 1, \$error) 350 or &my_die("Failed to prepare output tarfile: $error", $component, $error); 351 $file_name = basename($output_tarfile); 352 353 354 my $scheme = file_scheme($output_tarfile); 355 356 my $tarfile; 357 if ($scheme) { 358 $ipprc->file_create($output_tarfile) 359 or &my_die("Failed to create $output_tarfile: $error", $component, $error); 360 $tarfile = $ipprc->file_resolve($output_tarfile); 361 362 if ($scheme eq 'neb') { 363 &my_die("output file $output_tarfile not found", $component, $PS_EXIT_SYS_ERROR) 364 unless ($tarfile and -e $tarfile); 365 } 366 } else { 367 # no scheme the filename and the resolved filename are the same 368 $tarfile = $output_tarfile; 369 } 356 370 357 371 my $command = "tar -C $tmpdir --owner=ipp --group=users -czhf $tarfile ."; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/dist_component.pl
r27718 r30579 21 21 use PS::IPP::Metadata::Config; 22 22 use PS::IPP::Metadata::List qw( parse_md_list ); 23 24 23 use PS::IPP::Config 1.01 qw( :standard ); 25 26 my $ipprc = PS::IPP::Config->new(); # IPP configuration27 24 28 25 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 77 74 defined $outdir; 78 75 76 my $ipprc = PS::IPP::Config->new($camera); # IPP configuration 79 77 $ipprc->redirect_output($logfile) if $logfile; 78 79 my $temproot = metadataLookupStr($ipprc->{_siteConfig}, "TEMP.DIR"); 80 81 $temproot = "/tmp" if !defined $temproot; 80 82 81 83 if (($stage eq 'raw') and !$clean and !defined $chip_path_base) { … … 85 87 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 86 88 87 my ($rf, $rf_name) = tempfile(" /tmp/bundleresults.$dist_id.$component.XXXX", UNLINK => !$save_temps);89 my ($rf, $rf_name) = tempfile("$temproot/bundleresults.$dist_id.$component.XXXX", UNLINK => !$save_temps); 88 90 close $rf; 91 92 my $basename = basename($path_base); 93 my $outroot = "$outdir/$basename"; 89 94 90 95 my ($file_name, $bytes, $md5sum); … … 92 97 my $command = "$dist_make_bundle --camera $camera --stage $stage --stage_id $stage_id"; 93 98 $command .= " --results_file $rf_name"; 94 $command .= " --component $component --path_base $path_base --out dir $outdir";99 $command .= " --component $component --path_base $path_base --outroot $outroot"; 95 100 $command .= " --chip_path_base $chip_path_base" if $chip_path_base; 96 101 $command .= " --state $run_state" if defined $run_state; … … 136 141 &my_die("undefined file md5sum from dist_bundle.pl", $dist_id, $component, $outdir, $PS_EXIT_PROG_ERROR) unless defined $md5sum; 137 142 } 143 138 144 139 145 { -
branches/eam_branches/ipp-20101205/ippScripts/scripts/dist_defineruns.pl
r29068 r30579 42 42 43 43 # Parse the command-line arguments 44 my ($stage, $stage_limit, $dist_root, $ no_magic);44 my ($stage, $stage_limit, $dist_root, $workdir, $no_magic); 45 45 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 46 46 my @labels; … … 49 49 'stage=s' => \$stage, # stage to queue 50 50 'label=s' => \@labels, # labels 51 'workdir=s' => \$workdir, # workdir 51 52 'stage_limit=s' => \$stage_limit,# maximum number of runs queued for each stage 52 'dist_root=s' => \$dist_root, # root of distribution work area53 # 'dist_root=s' => \$dist_root, # root of distribution work area 53 54 'no_magic' => \$no_magic, # queue runs without requiring magic (for testing only) 54 55 'dbname=s' => \$dbname, # Database name … … 66 67 $ipprc->redirect_output($logfile) if $logfile; 67 68 68 if (!$dist_root) { 69 $dist_root = metadataLookupStr($ipprc->{_siteConfig}, "DISTRIBUTION_ROOT"); 70 &my_die("failed to find DISTRIBUTION_ROOT in site configuration", $PS_EXIT_CONFIG_ERROR) if !$dist_root; 69 if (!$workdir) { 70 print "workdir not supplied will use DISTRIBUTION_ROOT\n"; 71 # old method where we set workdir based on a config file 72 if (!$dist_root) { 73 $dist_root = metadataLookupStr($ipprc->{_siteConfig}, "DISTRIBUTION_ROOT"); 74 &my_die("failed to find DISTRIBUTION_ROOT in site configuration", $PS_EXIT_CONFIG_ERROR) if !$dist_root; 75 } 76 77 my ($day, $month, $year) = (gmtime)[3,4,5]; 78 my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day; 79 80 $workdir = $dist_root . "/$datestr"; 81 82 print "workdir is $workdir\n"; 71 83 } 72 73 my ($day, $month, $year) = (gmtime)[3,4,5];74 my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;75 76 my $workdir = "$dist_root/$datestr";77 78 print "workdir is $workdir\n";79 84 80 85 # if stage is not supplied as an argument, loop over all stages … … 90 95 my $command = "$disttool -definebyquery -stage $stage -workdir $workdir -label $label"; 91 96 $command .= " -no_magic" if $no_magic; 92 $command .= " - dry_run" if $no_update;97 $command .= " -pretend" if $no_update; 93 98 $command .= " -limit $stage_limit" if $stage_limit; 94 99 $command .= " -set_label $label"; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/dist_make_fileset.pl
r28963 r30579 96 96 # make sure that the database info file for this run exists 97 97 my $dbinfo_file = "$dist_dir/dbinfo.$stage.$stage_id.mdc"; 98 if (! -e "$dbinfo_file") {98 if (! $ipprc->file_exists($dbinfo_file) ) { 99 99 &my_die("dbinfo file for dist run $dbinfo_file not found", $dist_id, $dest_id, $PS_EXIT_UNKNOWN_ERROR); 100 100 } … … 103 103 # make sure that the dirinfo file for this run exists 104 104 my $dirinfo_file = "$dist_dir/dirinfo.$stage.$stage_id.mdc"; 105 if (! -e "$dirinfo_file") {105 if (!$ipprc->file_exists($dirinfo_file)) { 106 106 &my_die("dirinfo file for dist run $dirinfo_file not found", $dist_id, $dest_id, $PS_EXIT_UNKNOWN_ERROR); 107 107 } … … 277 277 $command .= " -dbname $dbname" if $dbname; 278 278 279 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 280 run(command => $command, verbose => $verbose); 281 unless ($success) { 282 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 283 print STDERR "Unable to perform $command error_code: $error_code\n"; 279 if (!$no_update) { 280 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 281 run(command => $command, verbose => $verbose); 282 unless ($success) { 283 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 284 print STDERR "Unable to perform $command error_code: $error_code\n"; 285 } 286 } else { 287 print STDERR "skipping $command\n"; 284 288 } 285 289 exit $fault; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/ipp_cleanup.pl
r30446 r30579 207 207 } 208 208 209 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 210 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 211 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 212 $command .= " -dbname $dbname" if defined $dbname; 213 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 214 run(command => $command, verbose => $verbose); 215 unless ($success) { 216 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 217 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 218 } 209 set_destreak_goto_cleaned(); 219 210 220 211 } else { … … 324 315 } 325 316 326 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 327 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 328 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 329 $command .= " -dbname $dbname" if defined $dbname; 330 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 331 run(command => $command, verbose => $verbose); 332 unless ($success) { 333 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 334 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 335 } 317 set_destreak_goto_cleaned(); 336 318 337 319 } else { … … 469 451 } 470 452 471 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 472 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 473 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 474 $command .= " -dbname $dbname" if defined $dbname; 475 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 476 run(command => $command, verbose => $verbose); 477 unless ($success) { 478 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 479 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 480 } 453 set_destreak_goto_cleaned(); 481 454 482 455 } else { … … 603 576 } 604 577 605 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 606 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 607 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 608 $command .= " -dbname $dbname" if defined $dbname; 609 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 610 run(command => $command, verbose => $verbose); 611 unless ($success) { 612 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 613 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 614 } 578 set_destreak_goto_cleaned(); 615 579 616 580 } else { … … 759 723 } 760 724 761 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 762 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 763 $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 764 $command .= " -dbname $dbname" if defined $dbname; 765 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 766 run(command => $command, verbose => $verbose); 767 unless ($success) { 768 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 769 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 770 } 725 set_destreak_goto_cleaned(); 771 726 772 727 } else { … … 2062 2017 } 2063 2018 2019 # this gets set to 1 the first time we set the corresponding destreak run to be cleaned 2020 my $ds_done = 0; 2021 sub set_destreak_goto_cleaned { 2022 2023 return if $ds_done; 2024 2025 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 2026 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 2027 my $command = "$magicdstool -stage $stage -stage_id $stage_id -updaterun -set_state goto_cleaned -set_label goto_cleaned"; 2028 $command .= " -dbname $dbname" if defined $dbname; 2029 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 2030 run(command => $command, verbose => $verbose); 2031 unless ($success) { 2032 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 2033 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 2034 } 2035 $ds_done = 1; 2036 } 2037 2064 2038 # XXX we currently do not set the error state in the db on my_die 2065 2039 sub my_die -
branches/eam_branches/ipp-20101205/ippScripts/scripts/magic_destreak_cleanup.pl
r30446 r30579 159 159 my $component = $comp->{component}; 160 160 my $backup_path_base = $comp->{backup_path_base}; 161 my $recovery_path_base = $comp->{recovery_path_base};162 161 my ($bimage, $bmask, $bch_mask, $bweight, $bsources, $bastrom); 163 162 my ($rimage, $rmask, $rch_mask, $rweight, $rsources, $rastrom); … … 197 196 $bsources = $ipprc->filename("PSPHOT.OUTPUT", $backup_path_base, $component); 198 197 } 199 if ($recovery_path_base) {200 $rimage = $ipprc->filename("PPIMAGE.CHIP", $recovery_path_base, $component);201 202 if ($dynamicMasks) {203 my $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $component);204 # This is kludgey but correct205 $rmask = dirname($recovery_path_base) . "/" . basename($mask);206 $rch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $recovery_path_base, $component);207 } else {208 $rmask = $ipprc->filename("PPIMAGE.CHIP.MASK", $recovery_path_base, $component);209 }210 $rweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $recovery_path_base, $component);211 }212 198 } elsif ($stage eq "camera") { 213 199 if ($backup_path_base) { … … 221 207 $bsources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $backup_path_base); 222 208 } 223 if ($recovery_path_base) {224 $rimage = $ipprc->filename("PSWARP.OUTPUT", $recovery_path_base);225 $rmask = $ipprc->filename("PSWARP.OUTPUT.MASK", $recovery_path_base);226 $rweight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $recovery_path_base);227 $rsources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $recovery_path_base);228 }229 209 } elsif ($stage eq "diff") { 230 210 my $name = "PPSUB.OUTPUT"; 211 if ($backup_path_base) { 212 $bimage = $ipprc->filename($name, $backup_path_base); 213 $bmask = $ipprc->filename("$name.MASK", $backup_path_base); 214 $bweight = $ipprc->filename("$name.VARIANCE", $backup_path_base); 215 # bills 2011-01-24 216 # don't clean up the uncensored Diff sources file 217 # $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 218 } 219 } 220 221 delete_files($bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask); 222 223 if ($stage eq "diff" and $warp_warp) { 224 my $name = "PPSUB.INVERSE"; 231 225 if ($backup_path_base) { 232 226 $bimage = $ipprc->filename($name, $backup_path_base); … … 237 231 # $bsources = $ipprc->filename("$name.SOURCES", $backup_path_base); 238 232 } 239 if ($recovery_path_base) { 240 $rimage = $ipprc->filename($name, $recovery_path_base); 241 $rmask = $ipprc->filename("$name.MASK", $recovery_path_base); 242 $rweight = $ipprc->filename("$name.VARIANCE", $recovery_path_base); 243 $rsources = $ipprc->filename("$name.SOURCES", $recovery_path_base); 244 } 245 } 246 247 delete_files($rimage, $rmask, $rweight, $rsources, $rastrom, $bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask); 248 249 if ($stage eq "diff" and $warp_warp) { 250 my $name = "PPSUB.INVERSE"; 251 if ($backup_path_base) { 252 $bimage = $ipprc->filename($name, $backup_path_base); 253 $bmask = $ipprc->filename("$name.MASK", $backup_path_base); 254 $bweight = $ipprc->filename("$name.VARIANCE", $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); 258 } 259 if ($recovery_path_base) { 260 $rimage = $ipprc->filename($name, $recovery_path_base); 261 $rmask = $ipprc->filename("$name.MASK", $recovery_path_base); 262 $rweight = $ipprc->filename("$name.VARIANCE", $recovery_path_base); 263 $rsources = $ipprc->filename("$name.SOURCES", $recovery_path_base); 264 } 265 # undef is not necessary, it's just to keep the lists in the same order. 266 delete_files($rimage, $rmask, $rweight, $rsources, undef, $bimage, $bmask, $bweight, $bsources); 233 delete_files($bimage, $bmask, $bweight, $bsources); 267 234 } 268 235 my $command = "$magicdstool -tocleanedfile -magic_ds_id $magic_ds_id -component $component"; -
branches/eam_branches/ipp-20101205/ippScripts/scripts/nightly_science.pl
r30446 r30579 1266 1266 } 1267 1267 1268 sub multi_date_verify_uniqueness_diff { 1269 my $warp_id_1 = shift; 1270 my $warp_id_2 = shift; 1271 my $date = shift; 1272 my $target = shift; 1273 1274 my $db = init_gpc_db(); 1275 $date =~ s/-//g; 1276 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1277 1278 my $count = 0; 1279 1280 my $sth = "SELECT DISTINCT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where (label = '$label' OR label = 'goto_cleaned') AND warp1 = $warp_id_1 AND warp2 = $warp_id_2"; 1281 my $data_ref = $db->selectall_arrayref( $sth ); 1282 $count += $#{ $data_ref } + 1; 1283 1284 $sth = "SELECT DISTINCT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where (label = '$label' OR label = 'goto_cleaned') AND warp1 = $warp_id_2 AND warp2 = $warp_id_1"; 1285 $data_ref = $db->selectall_arrayref( $sth ); 1286 $count += $#{ $data_ref } + 1; 1287 1288 return($count); 1289 } 1290 1268 1291 sub pre_diff_queue { 1269 1292 my $date = shift; … … 1375 1398 $metadata_out{nsDiffState} = 'DIFFING'; 1376 1399 } 1377 1400 if ($metadata_out{nsDiffState} eq 'FINISHED_DIFFS') { 1401 foreach my $target (sort (keys %science_config)) { 1402 if ($science_config{$target}{DIFFABLE} == 1) { 1403 foreach my $filter (@filter_list) { 1404 multi_date_diff_queue($date,$target,$filter,$pretend); 1405 } 1406 } 1407 } 1408 } 1378 1409 # if (($Npotential == $Nnoexp)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')&&($is_processing == 0)) { 1379 1410 # $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; … … 1511 1542 1512 1543 } 1544 1545 sub multi_date_diff_queue { 1546 my $date = shift; 1547 my $target = shift; 1548 my $filter = shift; 1549 my $pretend = shift; 1550 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1551 1552 my $db = init_gpc_db(); 1553 1554 my $obj_sth = "select DISTINCT rawExp.object from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1555 $obj_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND rawExp.filter = '$filter' ORDER BY rawExp.object"; 1556 1557 my $object_ref = $db->selectall_arrayref( $obj_sth ); 1558 1559 my $Npotential = 0; 1560 my $Nqueued = 0; 1561 1562 foreach my $object_row (@{ $object_ref }) { 1563 my $this_object = shift @{ $object_row }; 1564 # 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) "; 1565 # $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' "; 1566 # $input_sth .= " ORDER BY dateobs "; 1567 1568 my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment,warpRun.state AS warp_state FROM "; 1569 $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) "; 1570 $input_sth .= " WHERE warpRun.label = '$label' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' "; 1571 $input_sth .= " ORDER BY dateobs "; 1572 1573 my $warps = $db->selectall_arrayref( $input_sth ); 1574 1575 # Each comment should only appear once. Therefore, if we see it more than once, we assume the first is extra. 1576 my %comment_hash = (); 1577 foreach my $this_warp (@{ $warps }) { 1578 my $this_comment = ${ $this_warp }[3]; 1579 my $this_exp_id = ${ $this_warp }[0]; 1580 $comment_hash{$this_comment} = $this_exp_id; 1581 } 1582 1583 if (($#{ $warps } + 1) % 2 != 0) { 1584 print STDERR "md_diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps } "; 1585 if ($#{ $warps} + 1 == 1) { 1586 print STDERR ": I can do no diffs with only one exposure.\n"; 1587 next; 1588 } 1589 else { 1590 print STDERR ": I should declare an exposure to be faulty.\n"; 1591 my @keep_warps = (); 1592 # print "@{ $warps }\n"; 1593 foreach my $this_warp (@{ $warps }) { 1594 my $this_comment = ${ $this_warp }[3]; 1595 my $this_exp_id = ${ $this_warp }[0]; 1596 if ($comment_hash{$this_comment} == $this_exp_id) { 1597 push @keep_warps, $this_warp; 1598 } 1599 else { 1600 print STDERR "md_diff_queue: excluding $this_exp_id for $this_object\n"; 1601 } 1602 } 1603 @{ $warps } = @keep_warps; 1604 # print "@{ $warps }\n"; 1605 } 1606 } 1607 1608 while ($#{ $warps } > -1) { 1609 my $input_warp = shift @{ $warps }; 1610 my $input_exp_id = ${ $input_warp }[0]; 1611 my $input_comment = ${ $input_warp }[3]; 1612 1613 1614 my $template_warp = shift @{ $warps }; 1615 1616 my $template_exp_id = ${ $template_warp }[0]; 1617 1618 my $input_warp_id = ${ $input_warp }[1]; 1619 my $template_warp_id = ${ $template_warp }[1]; 1620 1621 my $input_warp_state = ${ $input_warp }[4]; 1622 my $template_warp_state = ${ $template_warp }[4]; 1623 1624 unless(defined($template_warp)&& defined($template_exp_id)) { 1625 print STDERR "md_diff received an undef! $input_exp_id $input_comment $this_object T: $template_warp V: @$template_warp\n"; 1626 next; 1627 } 1628 $Npotential++; 1629 1630 unless (defined($input_warp_id) && defined($template_warp_id) && 1631 ($input_warp_state eq 'full')&&($template_warp_state eq 'full')) { 1632 print STDERR "md_Diff for this $date $target $input_exp_id ($input_warp_id $input_warp_state) $template_exp_id ($template_warp_id $template_warp_state) not fully processed\n"; 1633 next; 1634 } 1635 1636 if (multi_date_verify_uniqueness_diff($input_warp_id,$template_warp_id,$date,$target) != 0) { 1637 $Nqueued++; 1638 print STDERR "md_Diffs already queued for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment\n"; 1639 next; 1640 } 1641 1642 my $new_data_group = "${data_group}.multi"; 1643 my $cmd = "$difftool -dbname $dbname -definewarpwarp "; 1644 $cmd .= "-input_label $label -template_label $label "; 1645 $cmd .= "-backwards "; # Needed because difftool assumes a different date sorting. 1646 $cmd .= "-set_workdir $workdir -set_dist_group $dist_group -set_data_group $new_data_group "; 1647 $cmd .= " -simple -set_label $label -exp_id $input_exp_id -template_exp_id $template_exp_id "; 1648 # $cmd .= " -pretend "; 1649 if (defined($pretend)) { 1650 $cmd .= ' -pretend '; 1651 } 1652 if ($debug == 1) { 1653 $cmd .= ' -pretend '; 1654 print STDERR "md_Diffs would like to queue for this $date $target $input_exp_id $template_exp_id ($input_warp_id $template_warp_id) $this_object $input_comment\n"; 1655 print STDERR "md_diff_queue: $cmd\n"; 1656 print STDERR " $input_warp_id $template_warp_id\n"; 1657 } 1658 1659 if (($debug == 0)&&(!defined($pretend))) { 1660 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1661 run ( command => $cmd, verbose => $verbose ); 1662 unless ($success) { 1663 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1664 &my_die("Unable to perform difftool: $error_code", 0,0,$date, $PS_EXIT_SYS_ERROR); 1665 } 1666 $Nqueued++; 1667 } 1668 } 1669 } 1670 $metadata_out{nsDiffPotential} += $Npotential; 1671 $metadata_out{nsDiffQueued} += $Nqueued; 1672 # if (($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued})&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) { 1673 # $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1674 # } 1675 1676 } 1513 1677 1514 1678 -
branches/eam_branches/ipp-20101205/ippScripts/scripts/register_exp.pl
r30446 r30579 255 255 if (exists($nightlyscience_config{$target}{OBSMODE})) { 256 256 $possible++; 257 if ($obsmode =~ / $nightlyscience_config{$target}{OBSMODE}/) {257 if ($obsmode =~ /^$nightlyscience_config{$target}{OBSMODE}$/) { 258 258 $match++; 259 259 } … … 261 261 if (exists($nightlyscience_config{$target}{OBJECT})) { 262 262 $possible++; 263 if ($object =~ / $nightlyscience_config{$target}{OBJECT}/) {263 if ($object =~ /^$nightlyscience_config{$target}{OBJECT}$/) { 264 264 $match++; 265 265 } … … 267 267 if (exists($nightlyscience_config{$target}{COMMENT})) { 268 268 $possible++; 269 if ($comment =~ / $nightlyscience_config{$target}{COMMENT}/) {269 if ($comment =~ /^$nightlyscience_config{$target}{COMMENT}$/) { 270 270 $match++; 271 271 } -
branches/eam_branches/ipp-20101205/ippScripts/scripts/warp_skycell.pl
r27754 r30579 71 71 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 72 72 73 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ); 74 $logDest .= ".update" if ($run_state eq 'update'); 73 my ($logDest, $traceDest); 74 if ($run_state eq 'new') { 75 $logDest = prepare_output("LOG.EXP", $outroot, $skycell_id, 0); 76 $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1); 77 } elsif ($run_state eq 'update') { 78 $logDest = prepare_output("LOG.EXP.UPDATE", $outroot, $skycell_id, 0); 79 $traceDest = prepare_output("TRACE.EXP.UPDATE", $outroot, $skycell_id, 1); 80 } else { 81 &my_die( "invalid run_state: $run_state", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR ); 82 } 83 84 my $neb; 85 my $scheme = file_scheme($outroot); 86 if ($scheme and $scheme eq 'neb') { 87 $neb = $ipprc->nebulous(); 88 } 75 89 76 90 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect; … … 117 131 unless ($success) { 118 132 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 119 &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $ error_code);133 &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $skycell_id, $tess_dir, $error_code); 120 134 } 121 135 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 122 &my_die("Unable to parse metadata config doc", $warp_id, $ PS_EXIT_PROG_ERROR);136 &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_PROG_ERROR); 123 137 $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE'); 124 138 } … … 141 155 142 156 143 my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id ); 144 my $outputMask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id); 145 my $outputWeight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $outroot, $skycell_id); 146 my $outputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $outroot, $skycell_id); 147 my $outputPSF = $ipprc->filename("PSPHOT.PSF.SKY.SAVE", $outroot); 148 my $outputBin1 = $ipprc->filename("PSWARP.BIN1", $outroot, $skycell_id ); 149 my $outputBin2 = $ipprc->filename("PSWARP.BIN2", $outroot, $skycell_id ); 150 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id ); 151 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id); 152 my $configuration = $ipprc->filename("PSWARP.CONFIG", $outroot, $skycell_id); 153 154 if ($run_state eq 'update') { 155 $traceDest .= ".update"; 156 $outputStats .= ".update"; 157 } 158 159 my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id ); 157 my $outputImage = prepare_output ("PSWARP.OUTPUT", $outroot, $skycell_id, 1); 158 my $outputMask = prepare_output ("PSWARP.OUTPUT.MASK", $outroot, $skycell_id, 1); 159 my $outputWeight = prepare_output ("PSWARP.OUTPUT.VARIANCE", $outroot, $skycell_id, 1); 160 my $outputSources = prepare_output ("PSWARP.OUTPUT.SOURCES", $outroot, $skycell_id, 1); 161 my $outputPSF = prepare_output ("PSPHOT.PSF.SKY.SAVE", $outroot, 1); 162 my $outputBin1 = prepare_output ("PSWARP.BIN1", $outroot, $skycell_id, 1); 163 my $outputBin2 = prepare_output ("PSWARP.BIN2", $outroot, $skycell_id, 1); 164 my $outputStats = prepare_output ("SKYCELL.STATS", $outroot, $skycell_id, 1); 165 my $configuration; 166 167 my $dump_config = 1; 168 if ($run_state eq 'new') { 169 $configuration = prepare_output ("PSWARP.CONFIG", $outroot, $skycell_id, 1); 170 } else { 171 $configuration = $ipprc->filename("PSWARP.CONFIG", $outroot, $skycell_id) or 172 &my_die("Missing entry from camera config PSWARP.CONFIG", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR); 173 if ($ipprc->file_exists($configuration)) { 174 $dump_config = 0; 175 } else { 176 print STDERR "WARNING: Config dump file $configuration is missing. Using current recipes and file rules.\n"; 177 178 # XXX: should we create a new config dump file? 179 # I vote yes but only if we can distingusing between temporarily unavailable and GONE. 180 my $gone = 0; 181 if (storage_object_exists($configuration, \$gone)) { 182 if ($gone) { 183 $configuration = prepare_output('PSWARP.CONFIG', $outroot, $skycell_id, 1); 184 # if we dump the config we need to insure that the config dump represents 185 # the full processing 186 } else { 187 # file is temporarily not available. Don't dump config. 188 $dump_config = 0; 189 } 190 } 191 } 192 } 193 194 195 my $skyFile = prepare_output ("SKYCELL.TEMPLATE", $outroot, $skycell_id, 1); 160 196 $ipprc->skycell_file( $tess_dir, $skycell_id, $skyFile, $verbose ) or &my_die("Unable to generate template skycell", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 161 197 ## XXX this seems to have insufficient error checking: dvoImageExtract can fail to write and still return a valid exit status … … 171 207 foreach my $imfile (@$imfiles) { 172 208 my $image = $imfile->{uri}; # Image name 173 my $weight = $ipprc->filename ("PPIMAGE.CHIP.VARIANCE", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name209 my $weight = $ipprc->filename ("PPIMAGE.CHIP.VARIANCE", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name 174 210 175 211 my $mask; # Mask name 176 212 if ($dynamicMasks) { 177 $mask = $ipprc->filename ("PSASTRO.OUTPUT.MASK", $imfile->{cam_path_base}, $imfile->{class_id});213 $mask = $ipprc->filename ("PSASTRO.OUTPUT.MASK", $imfile->{cam_path_base}, $imfile->{class_id}); 178 214 } else { 179 $mask = $ipprc->filename ("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id});215 $mask = $ipprc->filename ("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id}); 180 216 } 181 217 … … 186 222 # Astrometry file: astrometry is done at the camera stage, and always results in a MEF file 187 223 # XXX allow an option to use the image header astrometry? 188 my $astrom = $ipprc->filename ($astromSource, $imfile->{cam_path_base});224 my $astrom = $ipprc->filename ($astromSource, $imfile->{cam_path_base}); 189 225 190 226 &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless defined $astrom and $ipprc->file_exists($astrom); … … 245 281 $do_stats = 1; 246 282 } else { 247 #$command .= " -ipprc $configuration"; 248 my $resolved = $ipprc->file_resolve($configuration); 249 $command .= " -ipprc $resolved"; 283 $command .= " -ipprc $configuration"; 250 284 } 251 285 if ($do_stats) { … … 263 297 if ($do_stats) { 264 298 # Check first for the stats file 299 check_output($outputStats, 0); 265 300 my $outputStatsReal = $ipprc->file_resolve($outputStats); 266 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);301 # &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 267 302 &my_die("Stats file has zero size: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless -s $outputStatsReal; 268 303 269 # measure chipstats304 # measure skycell stats 270 305 $command = "$ppStatsFromMetadata $outputStatsReal - WARP_SKYCELL"; 271 306 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 283 318 284 319 if (!$quality) { 285 &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage); 286 &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 287 &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight); 288 &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 289 &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) if metadataLookupBool($recipe, 'PSF') and not $ipprc->file_exists($outputPSF); 290 if ($run_state eq 'new') { 291 &my_die("Couldn't find expected output file: $configuration", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($configuration); 320 # &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage); 321 # &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 322 # &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight); 323 # &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 324 # &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) if metadataLookupBool($recipe, 'PSF') and not $ipprc->file_exists($outputPSF); 325 326 check_output($outputImage, 0); 327 check_output($outputMask, 0); 328 check_output($outputWeight, 0); 329 check_output($outputSources, 1); 330 check_output($outputPSF, 1) if metadataLookupBool($recipe, 'PSF') ; 331 if ($dump_config) { 332 check_output($configuration, 1); 333 # &my_die("Couldn't find expected output file: $configuration", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($configuration); 292 334 } 293 335 } … … 335 377 } 336 378 } 379 380 exit 0; 381 382 # Prepare to write to an output file 383 # Lookup the filename in the rules. 384 # Make sure that if file exists and is a nebulous file that there is only one instance 385 # Deal with files that have been lost. 386 sub prepare_output 387 { 388 my $filerule = shift; 389 my $outroot = shift; 390 my $skycell_id = shift; 391 my $delete = shift; 392 $delete = 0 if !defined $delete; 393 394 my $error; 395 my $output = $ipprc->prepare_output($filerule, $outroot, $skycell_id, $delete, \$error) 396 or &my_die("failed to prepare output file for: $filerule", $warp_id, $skycell_id, $tess_dir, $error); 397 return $output; 398 } 399 400 sub check_output 401 { 402 my $file = shift; 403 my $replicate = shift; 404 405 if (!defined $file) { 406 return; 407 } 408 409 &my_die("Couldn't find expected output file: $file", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file); 410 411 if ($replicate and $neb) { 412 $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR); 413 } 414 } 415 416 # subroutine to check the status of a nebulous file. Used to distinguish between a storage object that 417 # does not exist and one that all of the instances have been lost. 418 # XXXX This should be implemented properly in Nebulous 419 # For now uses Bill's script 'whichnode' which queries the nebulous database directly 420 421 my $whichnode; 422 sub storage_object_exists 423 { 424 return 0 if !$neb; 425 426 my $file = shift; 427 my $ref_all_gone = shift; 428 429 my $exists = $neb->storage_object_exists($file); 430 if (!$exists) { 431 return 0; 432 } 433 434 if (!$whichnode) { 435 $whichnode = can_run('whichnode') or 436 &my_die("Can't find whichnode", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR); 437 } 438 439 my $command = "$whichnode $file"; 440 441 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 442 run(command => $command, verbose => $verbose); 443 unless ($success) { 444 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 445 &my_die("Unable to perform whichnode: $error_code", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR); 446 } 447 448 my @lines = split "\n", (join "", @$stdout_buf); 449 450 if (scalar @lines == 0) { 451 # no output the file is really and truely gone 452 # XXX: this is now caught above 453 print STDERR "storage object for $file does not exist\n"; 454 return 0; 455 } 456 457 my $numGone = 0; 458 my $numNotGone = 0; 459 foreach my $line (@lines) { 460 chomp $line; 461 462 # output lines are either 463 # "volume available" 464 # or 465 # "volume not available" 466 467 my ($volume, $answer, undef) = split " ", $line; 468 # our hack is if the volume has an X in the name it's gone 469 if ($volume =~ /X/) { 470 print STDERR "$file is on $volume which is gone\n"; 471 $numGone++; 472 } elsif ($answer eq 'available') { 473 $numNotGone++; 474 } elsif ($answer eq 'not') { 475 print STDERR "$file is on $volume which is not available\n"; 476 $numNotGone++; 477 } else { 478 print STDERR "unexpected output from whichnode: $line\n"; 479 } 480 } 481 # if there are any instances that are not on a gone volume set all_gone to 0 482 if ($numNotGone == 0 and $numGone > 0) { 483 $$ref_all_gone = 1; 484 } else { 485 $$ref_all_gone = 0; 486 } 487 488 # storage object exists so return true 489 return 1; 490 } 491 337 492 338 493 sub my_die -
branches/eam_branches/ipp-20101205/ippTasks/diskbalance.pro
r29631 r30579 194 194 book getword balancePending $pageName source_name -var SOURCE 195 195 book getword balancePending $pageName destination_name -var DESTINATION 196 196 book getword balancePending $pageName destination_host -var DEST_HOST 197 197 # Fix this with multihost restriction when possible. 198 set.host.for.balance $DEST INATION198 set.host.for.balance $DEST_HOST 199 199 200 200 stdout NULL -
branches/eam_branches/ipp-20101205/ippTasks/dist.pro
r30446 r30579 95 95 end 96 96 97 # This is now only used if we are not using a nebulous outroot 97 98 macro get.host.for.component 98 99 if ($0 != 3) … … 122 123 end 123 124 125 # This is now only used if we are not using a nebulous outroot 124 126 macro set.dist.workdir.by.component 125 127 if ($0 != 5) … … 139 141 book getword ipphosts distribution count -var count 140 142 if ("$count" == "NULL") 141 echo "ERROR: distributi n hosts list is empty"143 echo "ERROR: distribution hosts list is empty" 142 144 break 143 145 end … … 289 291 end 290 292 291 292 set.dist.workdir.by.component $DIST_STAGE_ID $COMPONENT $OUTDIR_TEMPLATE OUTDIR293 if ("$OUTDIR" == "NULL")294 echo ERROR failed to set workdir for $COMPONENT295 break296 end297 298 293 substr $COMPONENT 0 3 COMP_HEAD 299 294 if ("$COMP_HEAD" == "sky") 300 295 set.host.for.skycell $COMPONENT 296 set.workdir.by.skycell $COMPONENT $OUTDIR_TEMPLATE $default_host OUTDIR 301 297 else 302 # assume component is a class_id, if not we will default to anyhost 298 # assume component is a class_id, if it is not we will default to 299 # host "anyhost" 300 # and volume "any" 303 301 set.host.for.camera $CAMERA $COMPONENT 302 set.workdir.by.camera $CAMERA $COMPONENT $OUTDIR_TEMPLATE $default_host OUTDIR 303 end 304 305 if ("$OUTDIR" == "NULL") 306 echo ERROR failed to set workdir for $COMPONENT 307 break 304 308 end 305 309 306 310 sprintf logfile "%s/dist.%s.%s.log" $OUTDIR $DIST_ID $COMPONENT 307 # stdout $logfile308 # stderr $logfile309 311 310 312 $run = dist_component.pl --dist_id $DIST_ID --camera $CAMERA --stage $DIST_STAGE --stage_id $DIST_STAGE_ID --component $COMPONENT --path_base $PATH_BASE --chip_path_base $CHIP_PATH_BASE --state $STATE --data_state $DATA_STATE $EXTRA_ARGS --outdir $OUTDIR --logfile $logfile … … 401 403 book getpage distToAdvance 0 -var pageName -key pantaskState INIT 402 404 if ("$pageName" == "NULL") break 405 406 # XXX the sql for disttool -toadvance does not include the camera: 407 # hack around this for now 408 $CAMERA = GPC1 403 409 404 410 book setword distToAdvance $pageName pantaskState RUN … … 414 420 end 415 421 416 host anyhost 417 418 # using $DIST_ID as the "component" works fine here since we only look 419 # at the last two digits. But make sure that there 2 digits 420 $fake_component = $STAGE_ID + 10 421 set.dist.workdir.by.component $fake_component "exposure" $OUTDIR_TEMPLATE OUTDIR 422 substr $OUTDIR_TEMPLATE 0 3 SCHEME 423 if ("$SCHEME" == "neb") 424 # XXX This does not work if workdir is not in nebulous 425 # and $default_host == "any" because /data/any does not exist 426 # use "dummy" as component. Result will be 'any' 427 # set.workdir.by.camera $CAMERA dummy $OUTDIR_TEMPLATE $default_host OUTDIR 428 set.workdir.by.camera GPC1 dummy $OUTDIR_TEMPLATE $default_host OUTDIR 429 else 430 # using $DIST_ID as the "component" works fine here since we only look 431 # at the last two digits. But make sure that there 2 digits 432 $fake_component = $STAGE_ID + 10 433 set.dist.workdir.by.component $fake_component "exposure" $OUTDIR_TEMPLATE OUTDIR 434 end 435 422 436 if ("$OUTDIR" == "NULL") 423 437 echo ERROR failed to set workdir for $DIST_ID 424 438 break 425 439 end 440 host anyhost 426 441 427 442 sprintf logfile "%s/dist.advance.%s.log" $OUTDIR $DIST_ID 428 # stdout $logfile 429 # stderr $logfile 430 431 $run = dist_advancerun.pl --dist_id $DIST_ID --stage $STAGE --stage_id $STAGE_ID --outdir $OUTDIR $EXTRA_ARGS --logfile $logfile 443 444 $run = dist_advancerun.pl --dist_id $DIST_ID --stage $STAGE --stage_id $STAGE_ID --camera $CAMERA --outdir $OUTDIR $EXTRA_ARGS --logfile $logfile 432 445 add_standard_args run 433 446 -
branches/eam_branches/ipp-20101205/ippTasks/pstamp.pro
r30446 r30579 18 18 $pstampStopFaulted_DB = 0 19 19 20 # give up on dependents with fault_count >= $PSTAMP_MAX_FAULT_COUNT 21 $PSTAMP_MAX_FAULT_COUNT = 5 22 macro set.max.fault.count 23 $PSTAMP_MAX_FAULT_COUNT = $1 24 end 25 macro get.max.fault.count 26 echo maximum fault count: $PSTAMP_MAX_FAULT_COUNT 27 end 28 $POLL_DEP = 500 29 30 macro set.dependent.poll 31 $POLL_DEP = $1 32 end 33 macro get.dependent.poll 34 echo dependent poll limit: $POLL_DEP 35 end 36 20 37 # set PS_DBSERVER if postage stamp database host is not the same as the value for DBSERVER in site.config 21 38 # warning: no quotes around the two words. That causes the variable to get passed to pstamptool as one word … … 137 154 end 138 155 end 156 139 157 macro pstamp.find.on 140 158 task pstamp.request.find … … 143 161 end 144 162 macro pstamp.find.off 145 task pstamp.request.find.load 146 active false 163 task pstamp.request.find 164 active false 165 end 166 end 167 168 macro pstamp.dependent.on 169 task pstamp.dependent.load 170 active true 171 end 172 task pstamp.dependent.run 173 active true 174 end 175 end 176 macro pstamp.dependent.off 177 task pstamp.dependent.load 178 active false 179 end 180 task pstamp.dependent.run 181 active false 182 end 183 end 184 185 186 macro pstamp.status.on 187 task pstamp.save.status 188 active true 189 end 190 end 191 macro pstamp.status.off 192 task pstamp.save.status 193 active false 194 end 195 end 196 197 macro pstamp.status.set.exec 198 task pstamp.save.status 199 periods -exec $1 147 200 end 148 201 end … … 509 562 echo pstamp.job.run task.exit $JOB_ID status: $JOB_STATUS 510 563 end 511 showcommand failure564 # showcommand failure 512 565 process_exit pstampJob $options:0 $JOB_STATUS 513 566 end … … 593 646 add_poll_args run 594 647 add_poll_labels run 595 command $run 648 command $run -limit $POLL_DEP 596 649 end 597 650 … … 648 701 book getword pstampDependent $pageName outdir -var OUTDIR 649 702 book getword pstampDependent $pageName need_magic -var NEED_MAGIC 703 book getword pstampDependent $pageName fault_count -var FAULT_COUNT 650 704 book getword pstampDependent $pageName dbname -var DBNAME 651 705 … … 666 720 stderr $MYLOGFILE 667 721 668 $run = pstamp_checkdependent.pl --dep_id $DEP_ID --stage_id $STAGE_ID --stage $STAGE --component $COMPONENT --imagedb $IMAGEDB --rlabel $RLABEL $NEED_MAGIC 722 $run = pstamp_checkdependent.pl --dep_id $DEP_ID --stage_id $STAGE_ID --stage $STAGE --component $COMPONENT --imagedb $IMAGEDB --rlabel $RLABEL $NEED_MAGIC --fault_count $FAULT_COUNT --max_fault_count $PSTAMP_MAX_FAULT_COUNT 669 723 670 724 add_standard_args run … … 689 743 echo pstamp.job.run task.exit $DEP_ID status: $JOB_STATUS 690 744 end 691 showcommand failure745 # showcommand failure 692 746 process_exit pstampDependent $options:0 $JOB_STATUS 693 747 end … … 905 959 end 906 960 end 961 962 task pstamp.save.status 963 host local 964 965 periods -poll $LOADPOLL 966 periods -exec 90 967 periods -timeout 20 968 npending 1 969 970 task.exec 971 stdout NULL 972 stderr $LOGSUBDIR/pstamp.save.status.log 973 974 $run = pstamp_save_server_status.pl --update-link 975 command $run 976 end 977 978 task.exit $EXIT_SUCCESS 979 # echo nothing to do 980 end 981 982 task.exit default 983 showcommand failure 984 end 985 986 task.exit crash 987 showcommand crash 988 end 989 990 task.exit timeout 991 showcommand timeout 992 end 993 end -
branches/eam_branches/ipp-20101205/ippTasks/rcserver.pro
r28792 r30579 40 40 active false 41 41 end 42 task rcserver.revert43 active false44 end45 42 end 46 43 … … 48 45 task rcserver.revert 49 46 active true 47 end 48 end 49 50 macro rcserver.revert.off 51 task rcserver.revert 52 active false 50 53 end 51 54 end … … 136 139 137 140 sprintf logfile "%s/makefs.%s.%s.log" $DIST_DIR $DIST_ID $DEST_ID 138 stdout $logfile139 stderr $logfile140 141 141 142 book setword rcPendingFS $pageName pantaskState RUN 142 143 143 $run = dist_make_fileset.pl --dist_id $DIST_ID --target_id $TARGET_ID --stage $STAGE --stage_id $STAGE_ID --data_group $DATA_GROUP --filter $FILTER --dest_id $DEST_ID --product_name $PRODUCT_NAME --ds_dbhost $DS_DBHOST --ds_dbname $DS_DBNAME --dist_dir $DIST_DIR 144 $run = dist_make_fileset.pl --dist_id $DIST_ID --target_id $TARGET_ID --stage $STAGE --stage_id $STAGE_ID --data_group $DATA_GROUP --filter $FILTER --dest_id $DEST_ID --product_name $PRODUCT_NAME --ds_dbhost $DS_DBHOST --ds_dbname $DS_DBNAME --dist_dir $DIST_DIR --logfile $logfile 144 145 145 146 add_standard_args run -
branches/eam_branches/ipp-20101205/ippTasks/register.pro
r30446 r30579 105 105 106 106 macro register.add.date 107 if ($0 != 2)108 echo "USAGE: register.add.date (YYYY-MM-DD) "107 if ($0 != 4) 108 echo "USAGE: register.add.date (YYYY-MM-DD) (DBNAME) (VALID_BURNTOOL)" 109 109 break 110 110 end … … 112 112 book newpage regDates $1 113 113 book setword regDates $1 nsState NEW 114 book setword regDates $1 dbname $DB:0 115 end 116 117 118 $valid_burntool_value = 14 114 book setword regDates $1 dbname $2 115 book setword regDates $1 valid_burntool $3 116 end 117 118 119 # $valid_burntool_value = 14 119 120 $sunrise = 17:30:00 120 121 $sunset = 03:30:00 … … 565 566 if ($Npages == 0) 566 567 $today = `date -u +%Y-%m-%d` 568 $dbname = $DB:0 569 $valid_burntool = 14 567 570 else 568 571 book getpage regDates $reg_datePAGE -var today 572 book getword regDates $today dbname -var dbname 573 book getword regDates $today valid_burntool -var valid_burntool 569 574 $reg_datePAGE ++ 570 575 if ($reg_datePAGE >= $Npages) set reg_datePAGE = 0 … … 577 582 $dateobs_begin = $today\T$sunset 578 583 $dateobs_end = $today\T$sunrise 579 $run = $run -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end -valid_burntool $valid_burntool_value 580 if ($DB:n == 0) 581 option DEFAULT 582 else 583 # save the DB name for the exit tasks 584 option $DB:$regPendingBurntoolImfile_DB 585 $run = $run -dbname $DB:$regPendingBurntoolImfile_DB 586 $regPendingBurntoolImfile_DB ++ 587 if ($regPendingBurntoolImfile_DB >= $DB:n) set regPendingBurntoolImfile_DB = 0 588 end 584 $run = $run -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end -valid_burntool $valid_burntool 585 $run = $run -dbname $dbname 586 option $dbname 587 # if ($DB:n == 0) 588 # option DEFAULT 589 # else 590 # # save the DB name for the exit tasks 591 # option $DB:$regPendingBurntoolImfile_DB 592 # $run = $run -dbname $DB:$regPendingBurntoolImfile_DB 593 # if ("$dbname" != "$DB:$regPendingBurntoolImfile_DB") 594 # break 595 # end 596 # $regPendingBurntoolImfile_DB ++ 597 # if ($regPendingBurntoolImfile_DB >= $DB:n) set regPendingBurntoolImfile_DB = 0 598 # end 589 599 590 600 # echo $run … … 697 707 book setword regDates $today nsState NEW 698 708 book setword regDates $today dbname $DB:0 709 book setword regDates $today valid_burntool 14 699 710 700 711 command true -
branches/eam_branches/ipp-20101205/ippTasks/survey.pro
r30446 r30579 287 287 # user functions to manipulate dist labels 288 288 macro survey.add.dist 289 if ($0 != 2)290 echo "USAGE: survey.add.dist (label) "289 if ($0 != 3) 290 echo "USAGE: survey.add.dist (label) (workdir)" 291 291 break 292 292 end 293 293 book newpage SURVEY_DIST $1 294 book setword SURVEY_DIST $1 WORKDIR $2 294 295 book setword SURVEY_DIST $1 STATE PENDING 295 296 end … … 896 897 end 897 898 899 book getword SURVEY_DIST $label WORKDIR -var workdir_base 900 $year = `date +%Y` 901 $month = `date +%m` 902 $day = `date +%d` 903 $workdir = $workdir_base/$label/$year/$month/$day 904 898 905 book setword SURVEY_DIST $label STATE DONE 899 906 900 907 # note workdir is set by the script based on site.config 901 $run = dist_defineruns.pl --label $label 908 $run = dist_defineruns.pl --label $label --workdir $workdir 902 909 903 910 if ($DB:n == 0) … … 908 915 end 909 916 910 # echo $run 917 if ($VERBOSE > 1 ) 918 echo $run 919 end 911 920 command $run 912 921 end … … 1126 1135 end 1127 1136 1128 echo $run1137 # echo $run 1129 1138 1130 1139 command $run -
branches/eam_branches/ipp-20101205/ippToPsps/perl/ippToPsps/Gpc1Db.pm
r29234 r30579 34 34 35 35 return 1; 36 } 37 38 ########################################################################### 39 # 40 # Returns a count of warps thyat contributed to the stack with this stack ID 41 # 42 ########################################################################### 43 sub countContributingWarpsToStack { 44 my ($self, $stackId) = @_; 45 46 my $query = $self->{_db}->prepare(<<SQL); 47 SELECT COUNT(DISTINCT warp_id) 48 FROM stackInputSkyfile 49 WHERE stack_id = $stackId 50 SQL 51 52 $query->execute; 53 return scalar $query->fetchrow_array(); 36 54 } 37 55 -
branches/eam_branches/ipp-20101205/ippTools/share/camtool_find_pendingimfile.sql
- Property svn:mergeinfo changed
/trunk/ippTools/share/camtool_find_pendingimfile.sql (added) merged: 30049
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20101205/ippTools/share/chiptool_processedimfile.sql
r29199 r30579 29 29 rawImfile.magicked AS raw_magicked, 30 30 rawImfile.burntool_state, 31 IFNULL(magicDSRun.magic_ds_id, 0) AS magic_ds_id, 31 32 magicDSRun.state AS dsRun_state, 32 IFNULL(magicDSRun.magic_ds_id, 0) AS magic_ds_id33 magicDSFile.data_state AS dsFile_data_state 33 34 FROM chipRun 34 35 JOIN chipImfile … … 43 44 LEFT JOIN magicDSRun 44 45 ON stage_id = chip_id AND stage = 'chip' AND magicDSRun.re_place AND magicDSRun.state != 'drop' 46 LEFT JOIN magicDSFile ON magicDSRun.magic_ds_id = magicDSFile.magic_ds_id AND chipProcessedImfile.class_id = magicDSFile.component -
branches/eam_branches/ipp-20101205/ippTools/share/difftool_pendingcleanupskyfile.sql
r24186 r30579 9 9 USING(diff_id) 10 10 WHERE 11 ((diffRun.state = 'goto_cleaned' AND diffSkyfile.data_state = 'full')11 ((diffRun.state = 'goto_cleaned' AND (diffSkyfile.data_state = 'full' OR diffSkyfile.data_state = 'update')) 12 12 OR 13 13 (diffRun.state = 'goto_scrubbed' AND diffSkyfile.data_state != 'scrubbed') -
branches/eam_branches/ipp-20101205/ippTools/share/difftool_setskyfiletoupdate.sql
r29568 r30579 1 1 UPDATE diffRun 2 2 JOIN diffSkyfile USING(diff_id) 3 LEFT JOIN magicDSRun ON (stage_id = diff_id AND stage = 'diff')4 LEFT JOIN magicDSFile ON (magicDSRun.magic_ds_id = magicDSFile.magic_ds_id5 AND component = skycell_id)6 3 SET diffRun.state = 'update', 7 diffSkyfile.data_state = 'update' 4 diffSkyfile.data_state = 'update', 5 diffSkyfile.fault = 0 8 6 -- set hook %s 9 7 WHERE diff_id = %lld 10 8 AND (diffRun.state = 'cleaned' OR diffRun.state = 'update') 11 AND (diffSkyfile.data_state = 'cleaned' )9 AND (diffSkyfile.data_state = 'cleaned' OR diffSkyfile.data_state = 'update') -
branches/eam_branches/ipp-20101205/ippTools/share/magicdstool_setfiletoupdate.sql
r29561 r30579 7 7 WHERE magic_ds_id = %lld 8 8 AND (magicDSRun.state = 'cleaned' OR magicDSRun.state = 'update') 9 AND (magicDSFile.data_state = 'cleaned' )9 AND (magicDSFile.data_state = 'cleaned' OR magicDSFile.data_state ='update') -
branches/eam_branches/ipp-20101205/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed
/trunk/ippTools/share/pxadmin_create_tables.sql (added) merged: 29962,30049,30314
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20101205/ippTools/share/regtool_pendingexp.sql
r30102 r30579 48 48 GROUP BY newExp.exp_id 49 49 HAVING SUM(rawImfile.fault) = 0 50 LIMIT 256 50 51 ) AS RAWEXPOSURES 51 52 USING (exp_id) -
branches/eam_branches/ipp-20101205/ippTools/share/warptool_change_skyfile_data_state.sql
r26567 r30579 1 1 -- handle changes in warpSkyfile.data_state. 2 2 -- Used for the modes tofullskyfile, tocleanedskyfile and topurgedskyfile 3 -- arg s are new data_state, string for magic hook, warp_id, skycell_id and current expected state for warpRun3 -- arguments are are new data_state, string for magic hook, warp_id, skycell_id 4 4 UPDATE warpSkyfile 5 5 JOIN warpRun USING(warp_id) -
branches/eam_branches/ipp-20101205/ippTools/share/warptool_scmap.sql
r29349 r30579 12 12 IFNULL(magicDSRun.magic_ds_id, 0) AS magic_ds_id, 13 13 IFNULL(magicDSRun.state, 0) AS dsRun_state, 14 IFNULL(magicDSFile.data_state, 0) AS dsFile_data_state, 14 15 IFNULL(magicDSFile.fault, 0) as dsFile_fault 15 16 FROM warpRun -
branches/eam_branches/ipp-20101205/ippTools/share/warptool_setskyfiletoupdate.sql
r29568 r30579 1 1 UPDATE warpRun 2 2 JOIN warpSkyfile USING(warp_id) 3 LEFT JOIN magicDSRun ON (stage_id = warp_id AND stage = 'warp')4 LEFT JOIN magicDSFile ON (magicDSRun.magic_ds_id = magicDSFile.magic_ds_id5 AND component = skycell_id)6 3 SET warpRun.state = 'update', 7 warpSkyfile.data_state = 'update' 4 warpSkyfile.data_state = 'update', 5 warpSkyfile.fault = 0 8 6 -- set hook %s 9 7 WHERE warp_id = %lld 10 8 AND (warpRun.state = 'cleaned' OR warpRun.state = 'update') 11 AND (warpSkyfile.data_state = 'cleaned' )9 AND (warpSkyfile.data_state = 'cleaned' OR warpSkyfile.data_state = 'update') -
branches/eam_branches/ipp-20101205/ippTools/share/warptool_towarped.sql
r29171 r30579 11 11 exp_tag, 12 12 workdir, 13 label, 13 14 magicked, 14 15 path_base, … … 23 24 warpRun.state, 24 25 warpRun.reduction, 26 warpRun.label, 25 27 camRun.cam_id, 26 28 rawExp.camera, … … 76 78 warpRun.state, 77 79 warpRun.reduction, 80 warpRun.label, 78 81 camRun.cam_id, 79 82 rawExp.camera, -
branches/eam_branches/ipp-20101205/ippTools/src
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20101205/ippTools/src/chiptool.c
r30102 r30579 838 838 PXOPT_COPY_S16(config->args, where, "-fault", "chipProcessedImfile.fault", "=="); 839 839 840 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 841 840 842 if (!psListLength(where->list) 841 843 && !psMetadataLookupBool(NULL, config->args, "-all")) { … … 874 876 } 875 877 psFree(query); 878 879 if (!fault) { 880 // If fault has not been supplied, don't revert update faults with the magic value 881 // We don't do this for new runs because then they would never complete 882 // quality should be used to drop bad components 883 psStringAppend(&query_update, " AND (chipProcessedImfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT); 884 } 876 885 if (!p_psDBRunQuery(config->dbh, query_update)) { 877 886 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1919 1928 } 1920 1929 1930 // we do not update components with the magic fault value. They are non-updateable 1931 psStringAppend(&query, " AND (chipProcessedImfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT); 1932 1921 1933 if (!p_psDBRunQueryF(config->dbh, query, setHook, chip_id)) { 1922 1934 psError(PS_ERR_UNKNOWN, false, "database error"); -
branches/eam_branches/ipp-20101205/ippTools/src/difftool.c
r30530 r30579 917 917 PXOPT_COPY_S16(config->args, where, "-fault", "fault", "=="); 918 918 919 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 920 919 921 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { 920 922 psFree(where); … … 950 952 psLogMsg("difftool", PS_LOG_INFO, "Deleted %" PRIu64 " rows", psDBAffectedRows(config->dbh)); 951 953 954 if (!fault) { 955 // If fault has not been supplied, don't revert update faults with the magic value 956 // We don't do this for new runs because then they would never complete 957 // quality should be used to drop bad components 958 psStringAppend(&query_updated, " AND (diffSkyfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT); 959 } 952 960 if (!p_psDBRunQuery(config->dbh, query_updated)) { 953 961 psError(PS_ERR_UNKNOWN, false, "database error"); … … 3201 3209 psStringAppend(&query, " AND (diffSkyfile.skycell_id = '%s')", skycell_id); 3202 3210 } 3211 // we do not update components with the magic fault value. They are non-updateable 3212 // (But can be recovered with "difftool -revertwarped -fault 26" (PXTOOL_DO_NOT_REVERT_FAULT) 3213 psStringAppend(&query, " AND (diffSkyfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT); 3203 3214 3204 3215 if (!p_psDBRunQueryF(config->dbh, query, setHook, diff_id)) { -
branches/eam_branches/ipp-20101205/ippTools/src/disttool.c
r30446 r30579 1185 1185 PXOPT_COPY_S64(config->args, where, "-stage_id", "stage_id", "=="); 1186 1186 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 1187 PXOPT_COPY_STR(config->args, where, "-label", "label", "==");1187 pxAddLabelSearchArgs(config, where, "-label", "label", "=="); 1188 1188 PXOPT_COPY_S16(config->args, where, "-fault", "rcDSFileset.fault", "=="); 1189 1189 -
branches/eam_branches/ipp-20101205/ippTools/src/disttoolConfig.c
r29067 r30579 197 197 psMetadataAddS64(revertfilesetArgs, PS_LIST_TAIL, "-stage_id",0, "define stage_id", 0); 198 198 psMetadataAddStr(revertfilesetArgs, PS_LIST_TAIL, "-state", 0, "define state", NULL); 199 psMetadataAddStr(revertfilesetArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL);199 psMetadataAddStr(revertfilesetArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "define label", NULL); 200 200 psMetadataAddS16(revertfilesetArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0); 201 201 psMetadataAddBool(revertfilesetArgs, PS_LIST_TAIL, "-all", 0, "revert all faulted runs", NULL); -
branches/eam_branches/ipp-20101205/ippTools/src/dqstatstool.c
r28427 r30579 92 92 } 93 93 else { 94 psStringAppend(&query, " AND ( invalid IS NULL OR invalid = 1) ");94 psStringAppend(&query, " AND (warp_id IS NOT NULL AND invalid IS NULL) "); 95 95 } 96 96 … … 402 402 403 403 if (psMetadataLookupStr(&status,enginedef,"COLNAME")&& 404 isfinite(psMetadataLookupF32(&status,enginedef,"MINIMUM"))&& 405 isfinite(psMetadataLookupF32(&status,enginedef,"MAXIMUM"))) { 404 (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"STRICT") == 0)&& 405 (isfinite(psMetadataLookupF32(&status,enginedef,"MINIMUM"))&& 406 isfinite(psMetadataLookupF32(&status,enginedef,"MAXIMUM")))) { 406 407 psArrayAdd(decisionRules,decisionRules->n,enginedef); 408 } 409 else if (psMetadataLookupStr(&status,enginedef,"COLNAME")&& 410 (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"CDF") == 0)&& 411 (isfinite(psMetadataLookupF32(&status,enginedef,"CDF00"))&& 412 isfinite(psMetadataLookupF32(&status,enginedef,"CDF50"))&& 413 isfinite(psMetadataLookupF32(&status,enginedef,"CDF100")))) { 414 psArrayAdd(decisionRules,decisionRules->n, enginedef); 415 } 416 else if (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"UNUSED") == 0) { 407 417 } 408 418 else { … … 637 647 // Calculate if this exposure was "good" or not. 638 648 bool accept = true; 649 psF32 quality = 1.0; 639 650 for (long j = 0; j < decisionRules->n; j++) { 640 651 psMetadata *rule = decisionRules->data[j]; … … 644 655 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column name"); 645 656 return(false); 646 }647 psF32 min_value = psMetadataLookupF32(&status,rule,"MINIMUM");648 if (!status) {649 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find min value for %s",colname);650 return(false);651 }652 psF32 max_value = psMetadataLookupF32(&status,rule,"MAXIMUM");653 if (!status) {654 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find max value for %s",colname);655 return(false);656 }657 psString filter = psMetadataLookupStr(&status,rule,"FILTER");658 if (!status) {659 status = true;660 }661 if (filter) {662 psString imfilter = psMetadataLookupStr(&status,tableRow,"FILTER");663 if (strcmp(filter,imfilter) != 0) {664 continue;665 }666 657 } 667 658 // Not happy with this being set to a F32. Can this ever be something else? 668 659 psF32 value = psMetadataLookupF32(&status,tableRow,colname); 669 660 if (!status) { 670 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column %s (%f %f %f) in compare with rule.",colname,min_value,max_value,value); 661 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column %s (%f) in compare with rule.", 662 colname,value); 671 663 psFree(colNames); 672 664 psFree(colTypes); … … 677 669 return(false); 678 670 } 679 if ((value > max_value)||(value < min_value)) { 680 accept = false; 681 } 671 psString filter = psMetadataLookupStr(&status,rule,"FILTER"); 672 if (!status) { 673 status = true; 674 } 675 if (filter) { 676 psString imfilter = psMetadataLookupStr(&status,tableRow,"FILTER"); 677 if (strcmp(filter,imfilter) != 0) { 678 continue; 679 } 680 } 681 682 if (strcmp(psMetadataLookupStr(&status,rule,"RULETYPE"),"STRICT") == 0) { 683 psF32 min_value = psMetadataLookupF32(&status,rule,"MINIMUM"); 684 if (!status) { 685 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find min value for %s",colname); 686 return(false); 687 } 688 psF32 max_value = psMetadataLookupF32(&status,rule,"MAXIMUM"); 689 if (!status) { 690 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find max value for %s",colname); 691 return(false); 692 } 693 694 if ((value > max_value)||(value < min_value)) { 695 accept = false; 696 } 697 } // End STRICT min/max rule parsing 698 else if (strcmp(psMetadataLookupStr(&status,rule,"RULETYPE"),"CDF") == 0) { 699 // I'm just going to implement a quick linear interpolation over the points that exist. 700 psF32 min_value,max_value = 99; 701 psF32 min_cdf = 0.0,max_cdf = 1.0; 702 psF32 cdf; 703 psF32 try[22] = {0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50, 704 0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,0.99,1.00}; 705 int i; 706 int done = 0; 707 status = true; 708 min_value = psMetadataLookupF32(&status,rule,"CDF00"); 709 min_cdf = 0.0; 710 if (!isfinite(value)) { 711 quality = 0.0; 712 continue; 713 } 714 if (!status) { 715 status = true; 716 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find CDF00 value for %s",colname); 717 } 718 if (value < min_value) { 719 if (quality > min_cdf) { 720 quality = 0.0; 721 continue; 722 } 723 } 724 725 for (i = 1; i < 22; i++) { 726 psString label = psStringCopy(""); 727 psStringAppend(&label,"CDF%02d",(int) (100 * try[i])); 728 729 max_value = psMetadataLookupF32(&status,rule,label); 730 max_cdf = try[i]; 731 if (!status) { 732 status = true; 733 psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find %s value for %s",label,colname); 734 } 735 if ((value < max_value)&&(value > min_value)) { 736 cdf = ((value - min_value) * max_cdf + (max_value - value) * min_cdf) / (max_value - min_value); 737 // fprintf(stderr,"value: %f %f %f %f %f %f %d %d %f\n",value,quality,min_cdf,min_value,max_cdf,max_value, value < max_value, value > min_value,cdf); 738 if (quality > cdf) { 739 quality = cdf; 740 done = 1; 741 i = 25; 742 } 743 } 744 min_value = max_value; 745 min_cdf = max_cdf; 746 } 747 if (done) { 748 continue; 749 } 750 // Reached end of array without finding the value; 751 if (value > min_value) { 752 if (quality > min_cdf) { 753 quality = 1.0; 754 } 755 } 756 757 758 } // End CDF rule parsing 682 759 } 683 760 bool success; … … 695 772 return(false); 696 773 } 774 success = psMetadataAddF32(tableRow,PS_LIST_TAIL,"QUALITY",0,"",quality); 775 if (!success) { 776 psError(PS_ERR_UNKNOWN,false, "Error adding exposure quality to fits table row."); 777 psFree(colNames); 778 psFree(colTypes); 779 psFree(contents); 780 psFree(query); 781 psFree(outTable); 782 psFree(statsoutput); 783 psFree(statIter); 784 psFree(tableRow); 785 return(false); 786 } 697 787 698 788 // Add the row to the table array. -
branches/eam_branches/ipp-20101205/ippTools/src/magicdstool.c
r30446 r30579 1112 1112 1113 1113 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 1114 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 1114 1115 1115 1116 psString queryFile = NULL; 1117 bool stateIsUpdate = false; 1116 1118 if (state) { 1117 1119 if (! strcmp(state, "new") || !strcmp(state, "goto_restored")) { … … 1119 1121 } else if (!strcmp(state, "update")) { 1120 1122 queryFile = "magicdstool_revertupdated.sql"; 1123 stateIsUpdate = true; 1121 1124 } else { 1122 1125 psError(PXTOOLS_ERR_SYS, true, "%s is not a valid value for state", state); … … 1141 1144 } 1142 1145 psFree(where); 1146 1147 if (stateIsUpdate && !fault) { 1148 // If fault has not been supplied, don't revert update faults with 1149 // the magic "do not update" value 1150 // We don't do this for new runs because then they would never complete 1151 // quality should be used to drop bad components 1152 psStringAppend(&query, " AND magicDSFile.fault != %d", PXTOOL_DO_NOT_REVERT_FAULT); 1153 } 1143 1154 1144 1155 if (!p_psDBRunQuery(config->dbh, query)) { … … 1744 1755 } 1745 1756 1757 // we do not update components with the magic fault value. They are non-updateable 1758 // (But can be recovered with "magicdstool -revertdestreakedfile -fault 26" (PXTOOL_DO_NOT_REVERT_FAULT) 1759 psStringAppend(&query, " AND (magicDSFile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT); 1760 1746 1761 if (!p_psDBRunQueryF(config->dbh, query, setHook, magic_ds_id)) { 1747 1762 psError(PS_ERR_UNKNOWN, false, "database error"); -
branches/eam_branches/ipp-20101205/ippTools/src/magictool.c
- Property svn:mergeinfo changed
/trunk/ippTools/src/magictool.c merged: 30497
r30446 r30579 627 627 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 628 628 PXOPT_COPY_S16(config->args, where, "-fault", "fault", "=="); 629 PXOPT_COPY_STR(config->args, where, "-label", "label", "==");629 pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "=="); 630 630 631 631 psString query = psStringCopy("UPDATE magicRun SET fault = 0 WHERE state = 'new' AND fault != 0"); - Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20101205/ippTools/src/magictoolConfig.c
r30446 r30579 114 114 psMetadataAddS64(reverttreeArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magictool ID", 0); 115 115 psMetadataAddS16(reverttreeArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0); 116 psMetadataAddStr(reverttreeArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);116 psMetadataAddStr(reverttreeArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by label", NULL); 117 117 118 118 // -inputs -
branches/eam_branches/ipp-20101205/ippTools/src/pstamptool.c
r30446 r30579 571 571 PXOPT_COPY_S32(config->args, where, "-fault", "fault", "=="); 572 572 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 573 PXOPT_COPY_STR(config->args, where, "-reqType", "reqType", "=="); 574 PXOPT_COPY_STR(config->args, where, "-name", "name", "LIKE"); 573 575 PXOPT_COPY_TIME(config->args, where, "-timestamp_begin", "timestamp", ">="); 574 576 PXOPT_COPY_TIME(config->args, where, "-timestamp_end", "timestamp", "<="); … … 586 588 psStringAppend(&query, ", state = '%s'", state); 587 589 if (!strcmp(state, "goto_cleaned")) { 588 psStringAppend(&stateCheck, " AND state != 'cleaned'");590 psStringAppend(&stateCheck, " AND (state != 'cleaned' AND state != 'goto_cleaned')"); 589 591 } 590 592 } -
branches/eam_branches/ipp-20101205/ippTools/src/pstamptoolConfig.c
r30446 r30579 104 104 psMetadataAddS16(updatereqArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0); 105 105 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 106 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-reqType", 0, "search by reqType", NULL); 107 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-name", 0, "search by reqType (LIKE comparsion)", NULL); 106 108 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 107 109 psMetadataAddTime(updatereqArgs, PS_LIST_TAIL, "-timestamp_begin", 0, "search by timestamp (>=)", NULL); -
branches/eam_branches/ipp-20101205/ippTools/src/pxtools.h
r28486 r30579 51 51 # define MAX_ROWS 10e9 52 52 # define PXTOOL_MODE_NONE 0x0 53 // we do not revert or update components with this fault value 54 // This is the same value as PSTAMP_GONE 55 # define PXTOOL_DO_NOT_REVERT_FAULT 26 53 56 54 57 bool pxIsValidState(const char *state); -
branches/eam_branches/ipp-20101205/ippTools/src/warptool.c
r29903 r30579 1485 1485 PXOPT_COPY_S16(config->args, where, "-fault", "warpSkyfile.fault", "=="); 1486 1486 1487 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 1488 1487 1489 if (!psListLength(where->list) 1488 1490 && !psMetadataLookupBool(NULL, config->args, "-all")) { … … 1510 1512 } 1511 1513 psFree(where); 1514 1515 if (!fault) { 1516 // If fault has not been supplied, don't revert update faults with the magic value 1517 // We don't do this for new runs because then they would never complete 1518 // quality should be used to drop bad components 1519 psStringAppend(&query_updated, " AND warpSkyfile.fault != %d", PXTOOL_DO_NOT_REVERT_FAULT); 1520 } 1512 1521 1513 1522 if (!p_psDBRunQuery(config->dbh, query)) { … … 2003 2012 // shared code for the modes -tocleanedskyfile -tofullskyfile -topurgedskyfile 2004 2013 2005 static bool change_skyfile_data_state(pxConfig *config, psString data_state , psString run_state)2014 static bool change_skyfile_data_state(pxConfig *config, psString data_state) 2006 2015 { 2007 2016 PS_ASSERT_PTR_NON_NULL(config, false); … … 2065 2074 static bool tocleanedskyfileMode(pxConfig *config) 2066 2075 { 2067 return change_skyfile_data_state(config, "cleaned" , "goto_cleaned");2076 return change_skyfile_data_state(config, "cleaned"); 2068 2077 } 2069 2078 static bool tofullskyfileMode(pxConfig *config) 2070 2079 { 2071 return change_skyfile_data_state(config, "full" , "update");2080 return change_skyfile_data_state(config, "full"); 2072 2081 } 2073 2082 static bool topurgedskyfileMode(pxConfig *config) 2074 2083 { 2075 return change_skyfile_data_state(config, "purged" , "goto_purged");2084 return change_skyfile_data_state(config, "purged"); 2076 2085 } 2077 2086 static bool toscrubbedskyfileMode(pxConfig *config) 2078 2087 { 2079 return change_skyfile_data_state(config, "scrubbed" , "goto_scrubbed");2088 return change_skyfile_data_state(config, "scrubbed"); 2080 2089 } 2081 2090 … … 2101 2110 else { 2102 2111 if (strcmp(state,"error_cleaned") == 0) { 2103 change_skyfile_data_state(config,"error_cleaned" ,"goto_cleaned");2112 change_skyfile_data_state(config,"error_cleaned"); 2104 2113 } 2105 2114 else if (strcmp(state, "error_scrubbed") == 0) { 2106 change_skyfile_data_state(config,"error_scrubbed" ,"goto_scrubbed");2115 change_skyfile_data_state(config,"error_scrubbed"); 2107 2116 } 2108 2117 else if (strcmp(state, "error_purged") == 0) { 2109 change_skyfile_data_state(config,"error_purged" ,"goto_purged");2118 change_skyfile_data_state(config,"error_purged"); 2110 2119 } 2111 2120 else { … … 2526 2535 psStringAppend(&query, " AND (warpSkyfile.skycell_id = '%s')", skycell_id); 2527 2536 } 2537 // we do not update components with the magic fault value. They are non-updateable 2538 // (But can be recovered with "warptool -revertwarped -fault 26" (PXTOOL_DO_NOT_REVERT_FAULT) 2539 psStringAppend(&query, " AND (warpSkyfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT); 2528 2540 2529 2541 if (!p_psDBRunQueryF(config->dbh, query, setHook, warp_id)) { -
branches/eam_branches/ipp-20101205/pstamp/scripts/Makefile.am
r29330 r30579 17 17 pstamp_runcommand.sh \ 18 18 pstamp_server_status \ 19 pstamp_save_server_status.pl \ 19 20 pstamp_webrequest.pl \ 20 21 pstamp_get_image_job.pl \ 21 22 psmkreq \ 23 psstatus \ 22 24 pstampstopfaulted \ 23 25 pstamp_checkdependent.pl \ -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_checkdependent.pl
r30446 r30579 4 4 # 5 5 # Check the status of a pending pstampDependent insuring that 6 # the dependent processing has been queued and whether it is7 # finished or not6 # the any update processing that is needed has been queued and determine check 7 # whether the processing has finished or not 8 8 9 9 use warnings; … … 27 27 my $IPP_DIFF_MODE_STACK_STACK = 4; 28 28 29 my ($dep_id, $stage, $stage_id, $component, $imagedb, $rlabel, $need_magic );30 my ($dbname, $ dbserver, $verbose, $save_temps, $no_update);29 my ($dep_id, $stage, $stage_id, $component, $imagedb, $rlabel, $need_magic, $fault_count, $max_fault_count); 30 my ($dbname, $ps_dbserver, $verbose, $save_temps, $no_update); 31 31 32 32 GetOptions( … … 35 35 'stage_id=i' => \$stage_id, 36 36 'component=s' => \$component, 37 'imagedb=s' => \$imagedb, # dbname for images .37 'imagedb=s' => \$imagedb, # dbname for images lookups. 38 38 'rlabel=s' => \$rlabel, 39 39 'need_magic' => \$need_magic, 40 'fault_count=i' => \$fault_count, 41 'max_fault_count=i' => \$max_fault_count, 40 42 'dbname=s' => \$dbname, # postage stamp server dbname 41 'dbserver=s' => \$ dbserver,# postage stamp server dbserver43 'dbserver=s' => \$ps_dbserver, # postage stamp server dbserver 42 44 'verbose' => \$verbose, 43 45 'save-temps' => \$save_temps, … … 48 50 if !(defined $dep_id and defined $stage and defined $stage_id and 49 51 defined $component and defined $imagedb); 52 53 $max_fault_count = 5 if !$max_fault_count; 54 $fault_count = 0 if !defined $fault_count; 50 55 51 56 my $missing_tools; … … 61 66 } 62 67 68 my $ipprc = PS::IPP::Config->new(); 69 70 if (!$ps_dbserver) { 71 $ps_dbserver = metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER'); 72 } 73 $pstamptool .= " -dbname $dbname" if $dbname; 74 $pstamptool .= " -dbserver $ps_dbserver"; 75 63 76 # Append imagedb to the ippTools 77 # Note: configured DBSERVER is used for this server 64 78 $chiptool .= " -dbname $imagedb"; 65 79 $warptool .= " -dbname $imagedb"; … … 68 82 $magicdstool .= " -dbname $imagedb"; 69 83 70 my $ipprc = PS::IPP::Config->new();71 72 if (!$dbserver) {73 $dbserver = metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');74 }75 76 84 77 85 my $tool; 78 86 my $cmd; 79 87 my $dsRun_state = ""; 80 my $whole_run = ($component eq 'all'); 81 82 # XXX: whole_run was a concept that isn't practical. Having one dependent for 83 # a whole run makes finding errors too hard. We always have a dependent for each 84 # component. 85 # XXX: remove the unneeded code 86 my_die("component = 'all' not supported", $PS_EXIT_PROG_ERROR) if $whole_run;; 87 88 if ($whole_run) { 89 if ($stage eq "chip") { 90 $cmd = "$chiptool -listrun -chip_id $stage_id"; 91 } elsif ($stage eq "warp") { 92 $cmd = "$warptool -listrun -warp_id $stage_id"; 93 } elsif ($stage eq "diff") { 94 $cmd = "$difftool -listrun -diff_id $stage_id"; 95 } else { 96 my_die("unexpected stage $stage found", $PS_EXIT_PROG_ERROR); 97 } 88 89 if ($stage eq "chip") { 90 $cmd = "$chiptool -processedimfile -allfiles -chip_id $stage_id -class_id $component"; 91 } elsif ($stage eq "warp") { 92 $cmd = "$warptool -warped -warp_id $stage_id -skycell_id $component"; 93 } elsif ($stage eq "diff") { 94 $cmd = "$difftool -diffskyfile -diff_id $stage_id -skycell_id $component"; 98 95 } else { 99 if ($stage eq "chip") { 100 $cmd = "$chiptool -processedimfile -allfiles -chip_id $stage_id -class_id $component"; 101 } elsif ($stage eq "warp") { 102 $cmd = "$warptool -warped -warp_id $stage_id -skycell_id $component"; 103 } elsif ($stage eq "diff") { 104 $cmd = "$difftool -diffskyfile -diff_id $stage_id -skycell_id $component"; 105 } else { 106 my_die("unexpected stage $stage found", $PS_EXIT_PROG_ERROR); 107 } 96 my_die("unexpected stage $stage found", $PS_EXIT_PROG_ERROR); 108 97 } 109 98 … … 124 113 } 125 114 my $status = 0; 126 if (( $it->{state} eq 'full') or ($it->{state} eq 'update') and ($whole_run or ($it->{data_state} eq 'full'))115 if ((($it->{state} eq 'full') or ($it->{state} eq 'update')) and ($it->{data_state} eq 'full') 127 116 and (!$need_magic or $magic_ok or $it->{magicked} > 0)) { 128 117 129 # This Dependency is satisfied. All done! 118 # This Dependency is satisfied. All done. Release the pstampJobs 119 # 130 120 my $command = "$pstamptool -updatedependent -set_state full -dep_id $dep_id"; 131 $command .= " -dbname $dbname" if $dbname;132 $command .= " -dbserver $dbserver" if $dbserver;133 121 if (!$no_update) { 134 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 143 131 } elsif (($it->{state} eq 'cleaned') or ($it->{state} eq 'update')) { 144 132 # For warp and diff stages we need to call the 'queue_update' subroutines even if the 145 # data_state is update in order to check the earlier stages in the pipeline 146 # For example if warpSkyfile is in update state but the chip run that it depends on hasn't 147 # been updated we need to go and queue it. 148 149 if (($it->{state} ne 'cleaned') and $it->{fault}) { 150 my_die("Component faulted on update dep_id: $dep_id", 151 $PS_EXIT_SYS_ERROR); 133 # data_state is update in order to check the state of inputs in earlier stages in the pipeline 134 # For example if warpSkyfile is in update state but the chipRun that it depends on hasn't 135 # been updated we need to go and queue the chips for processing. 136 137 my $fault = $it->{fault}; 138 if (($fault eq $PSTAMP_GONE) or (($it->{state} eq 'update') and $fault)) { 139 $fault_count++; 140 print "$stage $stage_id $component has fault $fault\n"; 141 if ($it->{fault} eq $PSTAMP_GONE) { 142 faultJobs($PSTAMP_GONE); 143 exit 0; 144 } elsif ($fault_count >= $max_fault_count) { 145 print "$stage $stage_id $component has faulted $fault_count times. Giving up\n"; 146 147 faultComponent($stage, $stage_id, $component, $PSTAMP_GONE); 148 149 # fault the jobs 150 faultJobs($PSTAMP_GONE); 151 exit 0; 152 } 153 154 # assume the fault is transient. 155 my_die("Component faulted on update dep_id: $dep_id", $PS_EXIT_SYS_ERROR); 152 156 } 153 157 154 158 if ($stage eq 'chip') { 155 # check_states_chip takes an array so that check_states_warp can pass it set of chips159 # check_states_chip takes an array so that check_states_warp can pass it a set of chips 156 160 my $chips = [$it]; 157 $status = check_states_chip($it->{chip_id}, $ whole_run, $chips, $rlabel, $need_magic);161 $status = check_states_chip($it->{chip_id}, $chips, $rlabel, $need_magic); 158 162 } elsif ($stage eq 'warp') { 159 $status = check_states_warp($it, $ whole_run, $rlabel, $need_magic);163 $status = check_states_warp($it, $rlabel, $need_magic); 160 164 } elsif ($stage eq 'diff') { 161 $status = check_states_diff($it, $ whole_run, $rlabel, $need_magic);165 $status = check_states_diff($it, $rlabel, $need_magic); 162 166 } else { 163 167 my_die("Unexpected stage found $stage", $PS_EXIT_PROG_ERROR); 168 } 169 if ($status >= $PSTAMP_FIRST_ERROR_CODE) { 170 faultJobs($status); 164 171 } 165 172 } else { … … 173 180 my $job_fault = 0; 174 181 175 if (0) {176 if ($stage eq 'chip') {177 # XXX: There is no need to check this anymore. All magicked chipRuns have abs(burntool_state) >= 13178 # If something changes that causes an error, we will figure that out from the chip failure179 my $burntool_state = $it->{burntool_state};180 # XXX: get the value of 13 from the ppImage recipe181 if ($burntool_state and (abs($burntool_state) < 13)) {182 print STDERR "chip $it->{chip_id} $it->{class_id} has burntool_state $burntool_state. Not avaiable.\n";183 $job_fault = $PSTAMP_NOT_AVAILABLE;184 }185 }186 }187 182 if ($state eq 'error_cleaned') { 188 183 $job_fault = $PSTAMP_NOT_AVAILABLE; 189 } elsif (($state =~ /scrub/) or ($state =~ /purge/) ) {190 # jobs must have changed state since depenency was made184 } elsif (($state =~ /scrub/) or ($state =~ /purge/) or ($state eq 'drop')) { 185 # Component state must have been changed state since dependency was inserted. 191 186 print STDERR "Dependency cannot be satisfied\n"; 192 187 $job_fault = $PSTAMP_GONE; … … 195 190 my_die ("Unexpected state for ${stage}Run $stage_id $state", $PS_EXIT_PROG_ERROR); 196 191 } 192 197 193 if (!$job_fault and ($stage eq 'chip')) { 194 # should only get here with data_state 'full' and perhaps destreaking not done 195 my_die ("Unexpected state for ${stage}Run $stage_id $state", $PS_EXIT_PROG_ERROR) 196 if $it->{data_state} ne 'full'; 197 198 198 # chip processing is done, start destreaking. 199 199 my @chips; … … 201 201 $job_fault = check_states_magicDSRun($stage, $stage_id, \@chips, $rlabel, $need_magic, $it->{raw_magicked}, $it->{magic_ds_id}, $it->{dsRun_state}); 202 202 } 203 if ($job_fault) { 204 faultJobs($state, $stage, $stage_id, $job_fault); 203 204 if ($job_fault >= $PSTAMP_FIRST_ERROR_CODE) { 205 faultJobs($job_fault); 205 206 } 206 207 } … … 211 212 sub check_states_chip { 212 213 my $chip_id = shift; 213 my $whole_run = shift; # if true queue entire run for update 214 my $metadatas = shift; # an array of hashes, either from -processedimfile or -listrun 214 my $metadatas = shift; # an array of hashes, either from chiptool -processedimfile or warptool -scmap 215 215 my $rlabel = shift; # if defined a new label for the chipRun 216 216 my $need_magic = shift; 217 218 217 219 218 my $dsRun_state; … … 221 220 my @chips; 222 221 my $magic_ds_id; 223 if (!$whole_run) { 224 foreach my $chip (@$metadatas) { 225 $dsRun_state = $chip->{dsRun_state}; 226 $raw_all_magicked &= ($chip->{raw_magicked} > 0); 227 $magic_ds_id = $chip->{magic_ds_id}; 228 229 push @chips, $chip->{class_id}; 230 231 my $state = $chip->{state}; 232 my $data_state = $chip->{data_state}; 233 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or 234 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/)) { 235 236 print "chipRun state is $chip->{chip_id} has state: $state data_state: $data_state cannot update\n"; 237 faultJobs('stop', undef, undef, $PSTAMP_GONE); 238 239 return 0; 240 } elsif (($chip->{data_state} ne 'update') and ($chip->{data_state} ne 'full')) { 241 242 my $command = "$chiptool -setimfiletoupdate -chip_id $chip_id -class_id $chip->{class_id}"; 243 $command .= " -set_label $rlabel" if $rlabel; 244 245 if (!$no_update) { 246 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 247 run(command => $command, verbose => $verbose); 248 unless ($success) { 249 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 250 } 251 } else { 252 print "skipping $command\n"; 253 } 254 } elsif ($chip->{fault}) { 255 # fault the dependent 256 my_die("chip $chip->{chip_id} $chip->{class_id} faulted: $chip->{fault}", $chip->{fault}); 257 } elsif ($chip->{dsFile_fault}) { 258 # fault the dependent 259 my_die("magicDSFile $chip->{magic_ds_id} $chip->{chip_id} $chip->{class_id} faulted: $chip->{dsFile_fault}", $chip->{dsFile_fault}); 260 } 261 } 262 } else { 263 my $run = $metadatas->[0]; 264 $dsRun_state = $run->{dsRun_state}; 265 $raw_all_magicked = ($run->{raw_magicked} > 0); 266 my $state = $run->{state}; 267 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/)) { 268 print "chipRun state is $run->{chip_id} is in state $state cannot update\n"; 269 faultJobs('stop', undef, undef, $PSTAMP_GONE); 270 return 0; 271 } 272 273 # providing no -class_id arguments changes all imfiles with data_state = 'cleaned' to 'update' 274 my $command = "$chiptool -setimfiletoupdate -chip_id $chip_id"; 275 $command .= " -set_label $rlabel" if $rlabel; 276 277 if (!$no_update) { 278 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 279 run(command => $command, verbose => $verbose); 280 unless ($success) { 281 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 282 } 283 } else { 284 print "skipping $command\n"; 285 } 286 } 287 288 my $status = check_states_magicDSRun('chip', $chip_id, \@chips, $rlabel, $need_magic, $raw_all_magicked, $magic_ds_id, $dsRun_state); 289 290 return $status; 291 } 292 293 sub check_states_warp { 294 # check status of input chips. If state is not updatable set error code for job 295 296 # if chipProcessedImfile.state is cleaned call check_states_chip 297 298 my $metadata = shift; 299 my $whole_run = shift; # if true queue entire run for update 300 my $rlabel = shift; # if defined a new label for the chipRun 301 my $need_magic = shift; 302 303 my $raw_all_magicked = 1; # this gets cleared if any of the inputs aren't destreaked 304 305 my $warp_id = $metadata->{warp_id}; 306 my $skycell_id = $metadata->{skycell_id}; 307 my $state = $metadata->{state}; 308 my $data_state = $metadata->{data_state}; 309 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or 310 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/)) { 311 print STDERR "warpRun $warp_id $skycell_id has state $state $data_state faulting jobs\n"; 312 faultJobs('stop', undef, undef, $PSTAMP_GONE); 313 exit 0; 314 } 315 if (($state eq 'update') and ($metadata->{fault})) { 316 # fault dependent. 317 my $fault = $metadata->{fault}; 318 my_die("warp $warp_id $skycell_id faulted: $fault", $fault); 319 } 320 321 if (!$whole_run) { 322 my $skycell = $metadata; 323 my $skycell_id = $skycell->{skycell_id}; 324 325 my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id"; 326 my $data = runToolAndParse($command, $verbose); 327 if (!$data or scalar @$data == 0) { 328 # This happens if the chipProcessedImfile disappears which happened when earlier 329 # versions of chiptool -revertprocessedimfile didn't check the chipRun.state before 330 # deleing the row. 331 # Fault the jobs so that the Request can finish ... 332 faultJobs('stop', undef, undef, $PSTAMP_GONE); 333 # ... and fault the dependent so that we have a record of the error 334 my_die("failed to find warpSkyCelllMap for warpRun $warp_id skycell_id $skycell_id", 335 $PSTAMP_GONE); 336 } 337 338 339 my $chips_ready = 1; 340 my @chipsToUpdate; 341 my $chip_id; 342 foreach my $chip (@$data) { 343 $chip_id = $chip->{chip_id}; 344 if (($chip->{data_state} ne 'full') or ($need_magic and ($chip->{magicked} <= 0))) { 345 $chips_ready = 0; 346 $chip->{fault} = $chip->{chip_fault}; 347 push @chipsToUpdate, $chip; 222 223 my $queued_update = 0; 224 foreach my $chip (@$metadatas) { 225 $dsRun_state = $chip->{dsRun_state}; 226 $raw_all_magicked &= ($chip->{raw_magicked} > 0); 227 $magic_ds_id = $chip->{magic_ds_id}; 228 229 push @chips, $chip->{class_id}; 230 231 my $state = $chip->{state}; 232 my $data_state = $chip->{data_state}; 233 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or 234 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/) or ($data_state eq 'drop')) { 235 236 print "chipRun state is $chip->{chip_id} has state: $state data_state: $data_state cannot update\n"; 237 my $error_code; 238 if (($state eq 'error_cleaned') or ($data_state ='error_cleaned')) { 239 $error_code = $PSTAMP_NOT_AVAILABLE; 348 240 } else { 349 # this chip is good to go 350 } 351 } 352 353 if ($chips_ready and $skycell->{data_state} ne 'update') { 354 # the reason we defer setting the warp to update is so that we can handle error conditions at previous 355 # stages more easily. 356 my $command = "$warptool -setskyfiletoupdate -warp_id $warp_id -skycell_id $skycell->{skycell_id}"; 241 $error_code = $PSTAMP_GONE; 242 } 243 244 # caller will fault the jobs 245 return $error_code; 246 } elsif (($chip->{data_state} ne 'update') and ($chip->{data_state} ne 'full')) { 247 248 # chiptool does more state checking to insure this isn't done prematurely. 249 my $command = "$chiptool -setimfiletoupdate -chip_id $chip_id -class_id $chip->{class_id}"; 357 250 $command .= " -set_label $rlabel" if $rlabel; 358 251 … … 366 259 print "skipping $command\n"; 367 260 } 368 } elsif (scalar @chipsToUpdate > 0) { 369 return check_states_chip($chip_id, 0, \@chipsToUpdate, $rlabel, $need_magic); 370 } 371 } else { 372 my $warpRun = $metadata; 373 my $command = "$chiptool -listrun -chip_id $warpRun->{chip_id}"; 374 my $data = runToolAndParse($command, $verbose); 375 my_die("failed to find chipRun $warpRun->{chip_id} for warpRun $warp_id", $PS_EXIT_UNKNOWN_ERROR) 376 if !$data or scalar @$data != 1; 377 378 my $chipRun = $data->[0]; 379 380 my $chipRunState = $chipRun->{state}; 381 if (($chipRunState =~ /purge/) or ($chipRunState =~ /scrub/)) { 382 print STDERR "warpRun $warp_id depends on chipRun $chipRun->{chip_id} which is in state $chipRunState\n"; 383 faultJobs('stop', 'warp', $warp_id, $PSTAMP_GONE); 384 return 0; 385 } 386 my $warpRunState = $warpRun->{state}; 387 if (($chipRunState eq 'full') and (! $need_magic or ($chipRun->{magicked} > 0)) and ($warpRunState eq 'cleaned')) { 388 # The inputs and outputs are ready. Queue the warpRun for update. 389 390 # providing no -skycell_id arguments changes all skyfiles with data_state = 'cleaned' to 'update' 391 my $command = "$warptool -setskyfiletoupdate -warp_id $warp_id"; 392 $command .= " -set_label $rlabel" if $rlabel; 393 394 if (!$no_update) { 395 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 396 run(command => $command, verbose => $verbose); 397 unless ($success) { 398 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 399 } 400 } else { 401 print "skipping $command\n"; 402 } 403 } elsif ($chipRunState eq 'cleaned' or 404 (($chipRun->{state} eq 'full') and ($need_magic and ($chipRun->{magicked} < 0) and ($chipRun->{dsRun_state} ne 'new')))) { 405 my $data = [$chipRun]; 406 return check_states_chip($chipRun->{chip_id}, 1, $data, $rlabel, $need_magic); 407 } 408 } 409 410 # return value may be the return status of script so zero is good 411 return 0; 412 } 261 $queued_update = 1; 262 } elsif ($chip->{fault}) { 263 $fault_count++; 264 my $fault = $chip->{fault}; 265 266 if ($fault eq $PSTAMP_GONE) { 267 # caller will fault jobs 268 return $PSTAMP_GONE; 269 } elsif ($fault_count > $max_fault_count) { 270 print "$stage $stage_id has faulted $fault_count times. Giving up\n"; 271 $fault = $PSTAMP_GONE; 272 faultComponent('chip', $chip->{chip_id}, $chip->{class_id}, $PSTAMP_GONE); 273 return $PSTAMP_GONE; 274 } 275 # fault the dependent 276 my_die("chip $chip->{chip_id} $chip->{class_id} faulted: $chip->{fault}", $chip->{fault}); 277 } elsif ($chip->{dsFile_fault} eq $PSTAMP_GONE) { 278 print STDERR "magicDSFile $chip->{magic_ds_id} $chip->{chip_id} $chip->{class_id} is GONE"; 279 return $PSTAMP_GONE; 280 } elsif ($chip->{dsFile_fault} and ($chip->{dsFile_data_state} eq 'update')) { 281 # fault the dependent 282 my_die("magicDSFile $chip->{magic_ds_id} $chip->{chip_id} $chip->{class_id} faulted: $chip->{dsFile_fault}", $chip->{dsFile_fault}); 283 } 284 } 285 286 my $status = 0; 287 if (!$queued_update) { 288 $status = check_states_magicDSRun('chip', $chip_id, \@chips, $rlabel, $need_magic, $raw_all_magicked, $magic_ds_id, $dsRun_state); 289 } 290 291 return $status; 292 } 293 294 sub check_states_warp { 295 my $metadata = shift; 296 my $rlabel = shift; # if defined a new label for the chipRun 297 my $need_magic = shift; 298 299 my $exit_status = 0; 300 301 my $raw_all_magicked = 1; # this gets cleared if any of the inputs aren't destreaked 302 303 my $warp_id = $metadata->{warp_id}; 304 my $skycell_id = $metadata->{skycell_id}; 305 my $state = $metadata->{state}; 306 my $data_state = $metadata->{data_state}; 307 308 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or 309 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/) or ($data_state eq 'drop')) { 310 print STDERR "warpRun $warp_id $skycell_id has state $state $data_state faulting jobs\n"; 311 my $error_code; 312 if (($state eq 'error_cleaned') or ($data_state eq 'error_cleaned')) { 313 $error_code = $PSTAMP_NOT_AVAILABLE; 314 } else { 315 $error_code = $PSTAMP_GONE; 316 } 317 return $error_code 318 } 319 if (($state eq 'update') and ($metadata->{fault})) { 320 # fault dependent. 321 my $fault = $metadata->{fault}; 322 print STDERR "warp $warp_id $skycell_id faulted: $fault"; 323 return $fault; 324 } 325 326 my $skycell = $metadata; 327 328 # get the list of input chips for this skycell 329 my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id"; 330 my $data = runToolAndParse($command, $verbose); 331 if (!$data or scalar @$data == 0) { 332 # This happens if the chipProcessedImfile disappears which happened when earlier 333 # versions of chiptool -revertprocessedimfile didn't check the chipRun.state before 334 # deleting the row. 335 print STDERR "failed to find warpSkyCelllMap for warpRun $warp_id skycell_id $skycell_id"; 336 return $PSTAMP_GONE; 337 } 338 339 my $chips_ready = 1; 340 my @chipsToUpdate; 341 my $chip_id; 342 foreach my $chip (@$data) { 343 $chip_id = $chip->{chip_id}; 344 if (($chip->{data_state} ne 'full') or ($need_magic and ($chip->{magicked} <= 0))) { 345 $chips_ready = 0; 346 $chip->{fault} = $chip->{chip_fault}; 347 push @chipsToUpdate, $chip; 348 } else { 349 # this chip is done 350 } 351 } 352 353 if ($chips_ready and $skycell->{data_state} ne 'update') { 354 # the reason we defer setting the warp to update is so that we can handle error conditions at previous 355 # stages more easily. 356 my $command = "$warptool -setskyfiletoupdate -warp_id $warp_id -skycell_id $skycell->{skycell_id}"; 357 $command .= " -set_label $rlabel" if $rlabel; 358 359 if (!$no_update) { 360 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 361 run(command => $command, verbose => $verbose); 362 unless ($success) { 363 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 364 } 365 } else { 366 print "skipping $command\n"; 367 } 368 } elsif (scalar @chipsToUpdate > 0) { 369 my $fault = check_states_chip($chip_id, \@chipsToUpdate, $rlabel, $need_magic); 370 if ($fault) { 371 if ($fault eq $PSTAMP_GONE) { 372 # chip or dsfile that this skycell depends on has faulted in a way that is not recoverable 373 # fault the skycell 374 faultComponent('warp', $warp_id, $skycell->{skycell_id}, $PSTAMP_GONE); 375 } 376 $exit_status = $fault; 377 } 378 } 379 380 # return value may be used as the return status of script so we use zero as success 381 return $exit_status; 382 } 383 413 384 sub check_states_diff { 414 385 my $metadata = shift; 415 my $whole_run = shift; # if true queue entire run for update416 386 my $rlabel = shift; # if defined a new label for the chipRun 417 387 my $need_magic = shift; … … 419 389 my $diff_id = $metadata->{diff_id}; 420 390 my $diff_mode = $metadata->{diff_mode}; 421 if (!$whole_run) { 422 my $skycell = $metadata; 423 my $skycell_id = $skycell->{skycell_id}; 424 425 if ($diff_mode == $IPP_DIFF_MODE_WARP_STACK ) { 426 # check the state of the template stack 427 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack2}"; 428 my $stack = runToolAndParseExpectOne($command, $verbose); 429 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack; 430 431 if ($stack->{state} ne 'full') { 432 print STDERR "template stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 433 # this faults all jobs depending on this dep_id 434 faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE); 435 return $PSTAMP_GONE; 436 } 437 438 # now check the warp 439 $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id"; 440 my $warp = runToolAndParseExpectOne($command, $verbose); 441 my_die("failed to find warpSkyfile for warpRun $skycell->{warp1} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp; 442 443 if ($warp->{data_state} ne 'full') { 444 return check_states_warp($warp, 0, $rlabel, $need_magic); 445 } 446 # warps are ready fall through and queue the diff update 447 } elsif ($diff_mode eq $IPP_DIFF_MODE_WARP_WARP) { 448 my $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id"; 449 my $warp1 = runToolAndParseExpectOne($command, $verbose); 450 my_die("failed to find warpSkyfile for warpRun $skycell->{warp1} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp1; 451 452 my $warps_ready = 1; 453 my $status = 0; 454 if ($warp1->{data_state} ne 'full') { 455 $warps_ready = 0; 456 $status = check_states_warp($warp1, 0, $rlabel, $need_magic); 457 if ($status) { 458 return $status; 391 my $skycell = $metadata; 392 my $skycell_id = $skycell->{skycell_id}; 393 394 if ($diff_mode == $IPP_DIFF_MODE_WARP_STACK ) { 395 # check the state of the template stack 396 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack2}"; 397 my $stack = runToolAndParseExpectOne($command, $verbose); 398 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack; 399 400 if ($stack->{state} ne 'full') { 401 print STDERR "template stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 402 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 403 return $PSTAMP_GONE; 404 } 405 406 # now check the warp 407 $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id"; 408 my $warp = runToolAndParseExpectOne($command, $verbose); 409 my_die("failed to find warpSkyfile for warpRun $skycell->{warp1} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp; 410 411 if ($warp->{data_state} ne 'full') { 412 my $warp_status = check_states_warp($warp, 0, $rlabel, $need_magic); 413 if ($warp_status eq $PSTAMP_GONE) { 414 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 415 } 416 return $warp_status; 417 } 418 # warps are ready fall through and queue the diff update 419 } elsif ($diff_mode eq $IPP_DIFF_MODE_WARP_WARP) { 420 my $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id"; 421 my $warp1 = runToolAndParseExpectOne($command, $verbose); 422 my_die("failed to find warpSkyfile for warpRun $skycell->{warp1} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp1; 423 424 my $warps_ready = 1; 425 my $warp_status = 0; 426 if ($warp1->{data_state} ne 'full') { 427 $warps_ready = 0; 428 $warp_status = check_states_warp($warp1, 0, $rlabel, $need_magic); 429 if ($warp_status) { 430 if ($warp_status eq $PSTAMP_GONE) { 431 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 459 432 } 460 } 461 $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id"; 462 my $warp2 = runToolAndParseExpectOne($command, $verbose); 463 my_die("failed to find warpSkyfile for warpRun $skycell->{warp2} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp2; 464 465 if ($warp2->{data_state} ne 'full') { 466 $warps_ready = 0; 467 $status = check_states_warp($warp2, 0, $rlabel, $need_magic); 468 } 469 470 if (!$warps_ready) { 471 # don't queue the diff update yet 472 return $status; 473 } 474 475 } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_STACK ) { 476 # check the state of the input stack 477 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack2}"; 478 my $stack1 = runToolAndParseExpectOne($command, $verbose); 479 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack1; 480 481 if ($stack1->{state} ne 'full') { 482 print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 483 # this faults all jobs depending on this dep_id 484 faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE); 485 return $PSTAMP_GONE; 486 } 487 # check the state of the template stack 488 $command = "$stacktool -sumskyfile -stack_id $skycell->{stack2}"; 489 my $stack2 = runToolAndParseExpectOne($command, $verbose); 490 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack2; 491 492 if ($stack2->{state} ne 'full') { 493 print STDERR "template stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 494 # this faults all jobs depending on this dep_id 495 faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE); 496 return $PSTAMP_GONE; 497 } 498 499 # inputs are ready fall through and queue the diff update 500 } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_WARP ) { 501 # check the state of the input stack 502 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack1}"; 503 my $stack = runToolAndParseExpectOne($command, $verbose); 504 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack1}", $PS_EXIT_UNKNOWN_ERROR) if !$stack; 505 506 if ($stack->{state} ne 'full') { 507 print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 508 # this faults all jobs depending on this dep_id 509 faultJobs('stop', 'diff', $diff_id, $PSTAMP_GONE); 510 return $PSTAMP_GONE; 511 } 512 513 # now check the template warp 514 $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id"; 515 my $warp = runToolAndParseExpectOne($command, $verbose); 516 my_die("failed to find warpSkyfile for warpRun $skycell->{warp2} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp; 517 518 if ($warp->{data_state} ne 'full') { 519 return check_states_warp($warp, 0, $rlabel, $need_magic); 520 } 521 # warps are ready fall through and queue the diff update 433 return $warp_status; 434 } 435 } 436 $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id"; 437 my $warp2 = runToolAndParseExpectOne($command, $verbose); 438 my_die("failed to find warpSkyfile for warpRun $skycell->{warp2} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp2; 439 440 if ($warp2->{data_state} ne 'full') { 441 $warps_ready = 0; 442 $warp_status = check_states_warp($warp2, 0, $rlabel, $need_magic); 443 if ($warp_status eq $PSTAMP_GONE) { 444 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 445 } 446 } 447 448 if (!$warps_ready) { 449 # don't queue the diff update yet 450 return $warp_status; 451 } 452 # inputs are ready fall through and queue the diff update 453 454 } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_STACK ) { 455 # check the state of the input stack 456 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack2}"; 457 my $stack1 = runToolAndParseExpectOne($command, $verbose); 458 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack1; 459 460 if ($stack1->{state} ne 'full') { 461 print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 462 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 463 return $PSTAMP_GONE; 464 } 465 # check the state of the template stack 466 $command = "$stacktool -sumskyfile -stack_id $skycell->{stack2}"; 467 my $stack2 = runToolAndParseExpectOne($command, $verbose); 468 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack2}", $PS_EXIT_UNKNOWN_ERROR) if !$stack2; 469 470 if ($stack2->{state} ne 'full') { 471 print STDERR "template stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 472 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 473 return $PSTAMP_GONE; 474 } 475 476 # inputs are ready fall through and queue the diff update 477 } elsif ($diff_mode == $IPP_DIFF_MODE_STACK_WARP ) { 478 # check the state of the input stack 479 my $command = "$stacktool -sumskyfile -stack_id $skycell->{stack1}"; 480 my $stack = runToolAndParseExpectOne($command, $verbose); 481 my_die("failed to find stackSumSkyfile for stack_id $skycell->{stack1}", $PS_EXIT_UNKNOWN_ERROR) if !$stack; 482 483 if ($stack->{state} ne 'full') { 484 print STDERR "input stack for diffRun $diff_id $skycell_id is not in full state faulting jobs\n"; 485 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 486 return $PSTAMP_GONE; 487 } 488 489 # now check the template warp 490 $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id"; 491 my $warp = runToolAndParseExpectOne($command, $verbose); 492 my_die("failed to find warpSkyfile for warpRun $skycell->{warp2} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp; 493 494 if ($warp->{data_state} ne 'full') { 495 my $warp_status = check_states_warp($warp, 0, $rlabel, $need_magic); 496 if ($warp_status eq $PSTAMP_GONE) { 497 faultComponent('diff', $diff_id, $skycell_id, $PSTAMP_GONE); 498 } 499 return $warp_status; 500 } 501 # warps are ready fall through and queue the diff update 502 } else { 503 my_die("unexpected diff_mode found: $diff_mode", $PS_EXIT_PROG_ERROR); 504 } 505 506 if ($skycell->{data_state} ne 'update') { 507 my $command = "$difftool -setskyfiletoupdate -diff_id $diff_id -skycell_id $skycell_id"; 508 $command .= " -set_label $rlabel" if $rlabel; 509 510 if (!$no_update) { 511 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 512 run(command => $command, verbose => $verbose); 513 unless ($success) { 514 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 515 } 522 516 } else { 523 my_die("unexpected diff_mode found: $diff_mode", $PS_EXIT_PROG_ERROR); 524 } 525 526 if ($skycell->{data_state} ne 'update') { 527 my $command = "$difftool -setskyfiletoupdate -diff_id $diff_id -skycell_id $skycell_id"; 528 $command .= " -set_label $rlabel" if $rlabel; 529 530 if (!$no_update) { 531 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 532 run(command => $command, verbose => $verbose); 533 unless ($success) { 534 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 535 } 536 } else { 537 print "skipping $command\n"; 538 } 539 } 540 } else { 541 # XXX todo whole_run 542 return $PS_EXIT_PROG_ERROR; 517 print "skipping $command\n"; 518 } 543 519 } 544 520 … … 633 609 } 634 610 635 sub faultJobs { 636 my ($state, $stage, $stage_id, $job_fault) = @_; 637 638 my $command = "$pstamptool -updatejob -set_state stop -set_fault $job_fault -dep_id $dep_id"; 639 $command .= " -dbname $dbname" if $dbname; 640 $command .= " -dbserver $dbserver" if $dbserver; 641 if (!$no_update) { 642 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 643 run(command => $command, verbose => $verbose); 644 unless ($success) { 645 my_die("failed to set pstampJob.fault for dep_id: $dep_id", 646 $PS_EXIT_UNKNOWN_ERROR); 647 } 648 } else { 649 print "skipping $command\n"; 650 } 651 } 652 611 # Check the data_state of the magicDSFile associated with this component (currently only chip stage is supported) 612 # Returns zero on success. 613 # returns the PSTAMP fault code to use for the jobs if an unrecoverable error is detected 614 # And faults the dependent if transient errors occur 653 615 sub check_states_magicDSRun { 654 616 my $stage = shift; … … 661 623 my $dsRun_state = shift; 662 624 663 # XXX: this code assumes that destreaking is handled at thechip stage625 # XXX: this code assumes that for update destreaking is only performed for chip stage 664 626 my_die ("check_states_magicDSRun only implemented for chip stage", $PS_EXIT_PROG_ERROR) if $stage ne 'chip'; 665 627 … … 675 637 if ($need_magic and !$input_magicked) { 676 638 if (!defined($dsRun_state) or ($dsRun_state eq 'NULL')) { 639 # it is arguably a programming error if we get here 677 640 print "No magicDSRun for chipRun $stage_id and magic is required\n"; 678 faultJobs('stop', undef, undef, $PSTAMP_NOT_DESTREAKED);641 return $PSTAMP_NOT_DESTREAKED; 679 642 } elsif (($dsRun_state eq 'cleaned') or ($dsRun_state eq 'update')) { 680 643 foreach my $c (@$components) { … … 684 647 my_die("failed to find magicDSFile for ${stage}Run $stage_id $c", $PS_EXIT_UNKNOWN_ERROR); 685 648 } 686 if ($dsfile->{fault} > 0) { 649 if ($dsfile->{fault} eq $PSTAMP_GONE) { 650 print "magicDSFile has fault $PSTAMP_GONE\n"; 651 return $PSTAMP_GONE; 652 } 653 # destreak faults get cleared when the component is set to be updated 654 if (($dsfile->{data_state} eq 'update') and ($dsfile->{fault} > 0)) { 655 $fault_count++; 656 if ($fault_count > $max_fault_count) { 657 print "Destreak file $magic_ds_id $component for $stage $stage_id has faulted $fault_count times. Giving up\n"; 658 faultComponent('destreak', $magic_ds_id, $component, $PSTAMP_GONE); 659 return $PSTAMP_GONE; 660 } 661 # Assume fault is transient 687 662 my_die("faulted magicDSFile for ${stage}Run $stage_id $c fault: $dsfile->{fault}", 688 663 $PS_EXIT_UNKNOWN_ERROR); … … 690 665 if ($dsfile->{data_state} eq 'cleaned') { 691 666 $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) 667 # XXX: get the recoveryroot from a config file 668 # (It isn't actually used except to check whether it is a nebulous path) 693 669 $command .= " -set_recoveryroot neb://any/gpc1/destreak/recover"; 694 670 $command .= " -set_label $rlabel" if $rlabel; … … 708 684 } 709 685 } elsif ($dsRun_state eq 'failed_revert') { 686 # XXX: revert failures are rarely fixed. give up but say it's just not available not GONE 710 687 print "magicDSRun.state = $dsRun_state for chipRun $stage_id is in state failed_revert cannot update\n"; 711 faultJobs('stop', undef, undef, $PSTAMP_NOT_AVAILABLE);688 return $PSTAMP_NOT_AVAILABLE; 712 689 } else { 713 690 print "magicDSRun.state = $dsRun_state for chipRun $stage_id"; … … 716 693 } 717 694 } 695 718 696 return 0; 697 } 698 699 sub faultJobs { 700 my ($job_fault) = @_; 701 702 my $command = "$pstamptool -updatejob -set_state stop -set_fault $job_fault -dep_id $dep_id"; 703 if (!$no_update) { 704 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 705 run(command => $command, verbose => $verbose); 706 unless ($success) { 707 my_die("failed to set pstampJob.fault for dep_id: $dep_id", 708 $PS_EXIT_UNKNOWN_ERROR); 709 } 710 } else { 711 print "skipping $command\n"; 712 } 713 } 714 715 sub faultComponent { 716 my ($stage, $stage_id, $component, $fault) = @_; 717 718 my $command; 719 if ($stage eq 'chip') { 720 $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $component"; 721 } elsif ($stage eq 'warp') { 722 $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $component"; 723 } elsif ($stage eq 'diff') { 724 $command = "$difftool -updatediffskyfile -diff_id $stage_id -skycell_id $component"; 725 } elsif ($stage eq 'destreak') { 726 $command = "$magicdstool -updatedestreakedfile -magic_ds_id $stage_id -component $component"; 727 } else { 728 my_die("unexpected stage $stage found", $PS_EXIT_PROG_ERROR); 729 } 730 731 $command .= " -fault $fault"; 732 733 if (!$no_update) { 734 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 735 run(command => $command, verbose => $verbose); 736 unless ($success) { 737 carp "$cmd failed"; 738 } 739 } else { 740 print "skipping $command\n"; 741 } 719 742 } 720 743 … … 726 749 727 750 my $command = "$pstamptool -updatedependent -set_fault $fault -dep_id $dep_id"; 728 $command .= " -dbname $dbname" if $dbname;729 $command .= " -dbserver $dbserver" if $dbserver;730 751 if (!$no_update) { 731 752 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_job_run.pl
r30446 r30579 14 14 use File::Basename; 15 15 use File::Copy; 16 use File::Temp qw(tempfile );16 use File::Temp qw(tempfile tempdir); 17 17 use Digest::MD5::File qw( file_md5_hex ); 18 18 use PS::IPP::PStamp::RequestFile qw( :standard ); … … 144 144 } elsif (($options & $PSTAMP_REQUIRE_UNCENSORED) and ($stage ne 'chip')) { 145 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')) { 146 my_die("uncensored inputs not available for job $job_id", $job_id, $PSTAMP_NOT_AVAILABLE, 'stop'); 147 } elsif (($options & $PSTAMP_REQUEST_UNCENSORED) and ($params->{state} eq 'update') and ($stage ne 'chip')) { 148 # we can only restore pixels for chip stage images if the data has been updated. 149 # XXX: this test is not quite good enough. If all components have been updated then the 150 # state will be 'full' But this will get us going. 151 print "Run state is update: will make stamps from destreaked $stage images.\n"; 148 152 # make stamps from uncensored images 149 153 $muggle = 0; … … 151 155 # Try and replace the streaks from the recovery images 152 156 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 $temp_dir = metadataLookupStr($ipprc->{_siteConfig}, "TEMP.DIR") or &my_die("Unable to find temporary directory in site configuration", $job_id, $PS_EXIT_CONFIG_ERROR); 158 $tmproot = tempdir("$temp_dir/psjob.$job_id.XXXX", CLEANUP => !$save_temps); 157 159 my $muggle_command = "$streaksreplace -stage $stage -tmproot $tmproot"; 158 160 # find the "directory" of the input path_base … … 160 162 my $base = basename($image); 161 163 $tmpImage = "$tmproot/$base"; 164 165 @file_list = (); 162 166 163 167 # XXX: We should get the recovery_path_base from the magicDSFile but that requires a bunch of file rule and … … 180 184 $base = basename($variance); 181 185 $tmpVariance = "$tmproot/$base"; 182 $newFileArgs .= " - weight$tmpVariance";186 $newFileArgs .= " -variance $tmpVariance"; 183 187 my $recVariance = "$inputdir/REC_$base"; 184 188 $muggle_command .= " -weight $variance -recweight $recVariance"; … … 225 229 } 226 230 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 234 231 if ($exitStatus == 0) { 235 232 my $reglist = "$outdir/reglist$job_id"; -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstamp_server_status
r30446 r30579 25 25 26 26 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 27 #pod2usage( -msg => "Required options: --first --stage",28 # -exitval => 3) unless29 # defined $first and30 # defined $stage;31 27 32 28 # Look for programs we need … … 39 35 } 40 36 37 # XXX: Note under pantasks this will be the curent directory, so this 38 # isn't necessary if the pstamp/web stuff is configured to point at the 39 # ipp build. But currently it's running out of Bill's build 41 40 my $ipphome = "/home/panstarrs/ipp"; 41 my $status_cmd = "psstatus"; 42 42 43 $rundir = "$ipphome/pstamp" if !$rundir; 43 44 … … 45 46 46 47 48 49 my $now = `date -u`; 50 51 print "<b>Status updated: </b> $now<br /><br />\n"; 52 47 53 my $down = 0; 48 54 if ($down) { 49 55 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 } 56 # exit 0; 57 } else { 58 # talk to pantasks_server and get the status 52 59 53 my ($pts, $pantasks_script) = tempfile ('/tmp/pts.XXXX', UNLINK => !$save_temps);60 my ($pts, $pantasks_script) = tempfile ('/tmp/pts.XXXX', UNLINK => !$save_temps); 54 61 55 print $pts "status\n";56 print $pts "quit\n";57 close $pts;62 print $pts "status\n"; 63 print $pts "quit\n"; 64 close $pts; 58 65 59 my $command = "$pantasks_client < $pantasks_script"; 60 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 61 run(command => $command, verbose => $verbose); 62 unless ($success) { 63 $error_code = (($error_code >> 8) or 1); 64 if ($error_code == 12) { 65 #print "Postage Stamp Server is not running\n"; 66 print "Postage Stamp Server will be down for maintenance it will back shortly.\n"; 67 exit 0; 66 67 my $command = "$pantasks_client < $pantasks_script"; 68 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 69 run(command => $command, verbose => $verbose); 70 unless ($success) { 71 $error_code = (($error_code >> 8) or 1); 72 if ($error_code == 12) { 73 #print "Postage Stamp Server is not running\n"; 74 print "Postage Stamp Server will be down for maintenance it will back shortly.\n"; 75 exit 0; 76 } else { 77 warn("$command failed. exit status: $error_code"); 78 exit $error_code; 79 } 68 80 } 69 warn("$command failed. exit status: $error_code");70 exit $error_code;71 }72 81 73 my $output = join "", @$stdout_buf;82 my $output = join "", @$stdout_buf; 74 83 75 print "$output" if $verbose;84 print "$output" if $verbose; 76 85 77 my @lines = split "\n", $output;86 my @lines = split "\n", $output; 78 87 79 my ($scheduler_state, $controller_state);80 my $got_state = 0;81 my %tasks;82 foreach my $line (@lines) {83 chomp $line;84 next if !$line;85 my ($first, $second, $third);88 my ($scheduler_state, $controller_state); 89 my $got_state = 0; 90 my %tasks; 91 foreach my $line (@lines) { 92 chomp $line; 93 next if !$line; 94 my ($first, $second, $third); 86 95 87 if ($line =~ /Scheduler is/) {88 ($first, $second, $scheduler_state) = split " ", $line;89 $got_state = 1;90 # print "$first $second $third $scheduler_state\n";91 } elsif ($line =~ /Controller is/) {92 ($first, $second, $controller_state) = split " ", $line;93 # print "$first $second $third $controller_state\n";94 } elsif ($got_state == 1 and $line =~ /\+|\-/) {95 # print "$line\n";96 my ($task_state, $task, $nrun, $njobs, $ngood, $nfail, $ntime, $cmd) = split " ", $line;97 # print "$task $task_state\n";98 my %this_task = ( name => $task, nrun=> $nrun, njobs => $njobs, ngood => $ngood, nfail => $nfail, ntime => $ntime, cmd => $cmd );96 if ($line =~ /Scheduler is/) { 97 ($first, $second, $scheduler_state) = split " ", $line; 98 $got_state = 1; 99 # print "$first $second $third $scheduler_state\n"; 100 } elsif ($line =~ /Controller is/) { 101 ($first, $second, $controller_state) = split " ", $line; 102 # print "$first $second $third $controller_state\n"; 103 } elsif ($got_state == 1 and $line =~ /\+|\-/) { 104 # print "$line\n"; 105 my ($task_state, $task, $nrun, $njobs, $ngood, $nfail, $ntime, $cmd) = split " ", $line; 106 # print "$task $task_state\n"; 107 my %this_task = ( name => $task, nrun=> $nrun, njobs => $njobs, ngood => $ngood, nfail => $nfail, ntime => $ntime, cmd => $cmd ); 99 108 100 # change '.' in task name to '_' so we have a valid hash key 101 $task =~ s/\./\_/g; 102 $tasks{$task} = \%this_task; 109 # change '.' in task name to '_' so we have a valid hash key 110 $task =~ s/\./\_/g; 111 $tasks{$task} = \%this_task; 112 } 113 } 114 115 if ($scheduler_state) { 116 print "Pantasks Scheduler $scheduler_state.\n"; 117 if ($controller_state) { 118 print $br . "Pantasks Controller $controller_state.\n"; 119 } else { 120 print STDERR "Controller state not found"; 121 exit 1; 122 } 123 print "$br$br\n"; 124 } else { 125 print STDERR "Scheduler state not found"; 126 exit 1; 127 } 128 129 my $request_run = $tasks{'pstamp_request_run'}; 130 my $request_fin = $tasks{'request_finish_run'}; 131 my $job_run = $tasks{'pstamp_job_run'}; 132 133 134 if ($request_run) { 135 # print "<br >\n"; 136 print "<b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully. $request_run->{nfail} failed to parse."; 137 if ($request_fin) { 138 print " $request_fin->{ngood} Requests finished."; 139 } else { 140 print "Task request.finish.run not found.\n"; 141 } 142 print "\n"; 143 print "\n"; 144 if ($job_run) { 145 print "<br /><b>Job Status:</b> $job_run->{nrun} running. $job_run->{ngood} completed successfully. $job_run->{nfail} failed"; 146 print "<br />\n"; 147 } else { 148 print "Task pstamp.job.run not found.<br />\n"; 149 } 150 } else { 151 print "Task pstamp.request.run not found.\n"; 103 152 } 104 153 } 105 154 106 if ($scheduler_state) { 107 print "Pantasks Scheduler $scheduler_state.\n"; 108 if ($controller_state) { 109 print $br . "Pantasks Controller $controller_state.\n"; 110 } else { 111 print STDERR "Controller state not found"; 112 exit 1; 113 } 114 print "$br$br\n"; 115 } else { 116 print STDERR "Scheduler state not found"; 117 exit 1; 155 # now run the script psstatus to check the status of running requests and finished requests 156 print "<br /><b>Unfinished Requests</b><br />\n"; 157 print "<pre>\n"; 158 system "$status_cmd --totals"; 159 print "</pre>\n"; 160 161 #print "<br />\n"; 162 163 164 # print "<br /><b>Unfinished Requests</b><br />\n"; 165 print "<pre>\n"; 166 system "$status_cmd --running"; 167 print "</pre>\n"; 168 169 if (0) { 170 # these are included in running requests above 171 print "<br /><b>Requests building results fileset</b><br/>\n"; 172 print "<pre>\n"; 173 system "$status_cmd --finishing"; 174 print "</pre>\n"; 118 175 } 119 176 120 my $request_run = $tasks{'pstamp_request_run'}; 121 my $request_fin = $tasks{'request_finish_run'}; 122 my $job_run = $tasks{'pstamp_job_run'}; 123 124 125 if ($request_run) { 126 print "<br /><b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully. $request_run->{nfail} failed to parse."; 127 if ($request_fin) { 128 print " $request_fin->{ngood} Requests finished."; 129 } else { 130 print "Task request.finish.run not found.\n"; 131 } 132 print "\n"; 133 print "\n"; 134 if ($job_run) { 135 print "<br /><b>Job Status:</b> $job_run->{nrun} running. $job_run->{ngood} completed successfully. $job_run->{nfail} failed"; 136 print "<br />\n"; 137 } else { 138 print "Task pstamp.job.run not found.<br />\n"; 139 } 140 print "<br /><b>Unfinished Requests</b><br />\n"; 141 print "<pre>\n"; 142 system "/home/panstarrs/bills/ipp/tools/psstatus -r "; 143 print "</pre>\n"; 144 print "<br /><b>Requests completed in last 24 hours (most recently completed first)</b><br />\n"; 145 print "<pre>\n"; 146 # finished requests 147 system "/home/panstarrs/bills/ipp/tools/psstatus -f"; 148 print "</pre>\n"; 149 } else { 150 print "Task pstamp.request.run not found.\n"; 151 } 152 153 177 print "<br /><b>Requests completed in last 24 hours (most recently completed first)</b><br />\n"; 178 print "<pre>\n"; 179 system "$status_cmd --finished"; 180 print "</pre>\n"; 154 181 155 182 -
branches/eam_branches/ipp-20101205/pstamp/scripts/pstampparse.pl
r30446 r30579 932 932 my $data_state = $image->{data_state}; 933 933 $data_state = $run_state if $stage eq 'stack'; 934 if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/) or ($run_state eq 'drop')) { 934 my $component_fault = $image->{fault}; 935 my $stage_id = $image->{stage_id}; 936 my $component = $image->{component}; 937 938 if ($component_fault eq $PSTAMP_GONE) { 935 939 # image is gone and it's not coming back 940 print STDERR "$stage $stage_id $component is gone\n"; 941 $$r_newState = 'stop'; 942 $$r_fault = $PSTAMP_GONE; 943 } elsif (($run_state =~ /purged/) or ($run_state =~ /scrubbed/) or ($run_state eq 'drop')) { 944 # image is gone and it's not coming back 945 print STDERR "$stage $stage_id $component has state: $run_state data_state: $data_state\n"; 936 946 $$r_newState = 'stop'; 937 947 $$r_fault = $PSTAMP_GONE; 938 948 } elsif (($run_state eq "error_cleaned") or ($data_state eq 'error_cleaned')) { 939 949 # if cleanup had an error don't get the user's hopes up set fault to gone 950 print STDERR "$stage $stage_id $component has state: $run_state data_state: $data_state\n"; 940 951 $$r_newState = 'stop'; 941 952 $$r_fault = $PSTAMP_GONE;
Note:
See TracChangeset
for help on using the changeset viewer.
