- Timestamp:
- Aug 19, 2010, 6:50:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/ippMonitor/raw/czartool_labels.php
r28794 r28980 10 10 //$db = dbconnect($ID['proj']); 11 11 $czardb = dbconnect("czardb"); // HACK to connect to czarDb 12 $lastUpdateTime = getLastUpdateTime($czardb); 13 12 14 $gpc1db = dbconnect($ID['proj']); 13 15 … … 22 24 else {$myMenu = "ipp.imfiles.dat";} 23 25 24 menu($myMenu, 'Czartool ', 'ipp.css', $ID['link'], $ID['proj']);26 menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']); 25 27 26 28 $pass = $ID['pass']; … … 31 33 $selectedLabel = $_GET[label]; 32 34 $selectedServer = $_GET[server]; 33 $selectedRevertServer = $_GET[revertserver];34 35 $selectedRevertStage = $_GET[revertstage]; 35 36 $selectedRevertMode = $_GET[revertmode]; 36 37 37 if ($selectedLabel == "") $selectedLabel = "all_labels"; 38 if ($selectedStage == "") $selectedStage = "all_stages"; 38 if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; } 39 if ($selectedStage == "") { $selectedStage = "all_stages"; } 40 41 echo 'Some documentation can be found <a href="http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing">here</a><br>'; 39 42 40 43 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later 41 $currentRevertMode; 42 if ($selectedRevertStage != "" && $selectedRevertMode != "" && $selectedRevertServer != "" ) { 43 44 exec("czartool_revert.pl -s $selectedRevertServer -t $selectedRevertStage -o $selectedRevertMode", $response, $status);44 if ($selectedRevertStage != "" && $selectedRevertMode != "") { 45 46 exec("czartool_revert.pl -t $selectedRevertStage -o $selectedRevertMode", $response, $status); 47 $currentRevertMode; 45 48 if ($response[0] == "off") $currentRevertMode = 0; 46 49 else if ($response[0] == "on") $currentRevertMode = 1; 50 51 setRevertStatus($czardb, $selectedRevertStage, $currentRevertMode); 47 52 } 48 53 $debug = 0; … … 51 56 $distLabels = getLabels($czardb, "distribution"); 52 57 $pubLabels = getLabels($czardb, "publishing"); 58 $updateLabels = getLabels($czardb, "update"); 53 59 54 60 if ($debug) { … … 81 87 echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n"; 82 88 echo "</form>\n"; 83 $lastUpdateTime = getLastUpdateTime($czardb);84 89 echo "<p align=\"center\"> Current status of IPP (any faults are shown in parentheses). NOTE: This data is good as of: $lastUpdateTime </p>"; 85 90 86 91 echo "<table>\n"; 87 92 echo "<tr>\n"; 93 echo "<td>\n"; 94 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage\"><br>"; 95 echo "</td>\n"; 88 96 89 97 echo "<td> \n"; 90 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage\"><br>\n"; 91 echo "</td>\n"; 92 93 echo "<td> \n"; 94 createLabelsTable($pass, $proj, $czardb, $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage, $selectedRevertStage, $currentRevertMode); 95 echo "</td>\n"; 96 97 echo "</tr>\n"; 98 echo "<tr>\n"; 99 100 echo "<table>\n"; 101 echo "<tr valign=top>\n"; 102 echo "<td> \n"; 103 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage\"><br>\n"; 104 echo "</td>\n"; 105 echo "<td> \n"; 106 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage); 107 echo "</td>\n"; 108 109 echo "<td> \n"; 110 $today = date("Y-m-d"); // 03.10.01 111 showSummitData($gpc1db, $today); 98 createLabelsTable($pass, $proj, $czardb, "stdscience", $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage); 112 99 echo "</td>\n"; 113 100 echo "</tr>\n"; 114 echo "</table>\n"; 115 if ($selectedServer) showServerStatus($selectedServer); 116 101 102 echo "<tr>\n"; 103 echo "<td>\n"; 104 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage\"><br>"; 105 echo "</td>\n"; 106 107 echo "<td> \n"; 108 createLabelsTable($pass, $proj, $czardb, "update", $updateLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage); 109 echo "</td>\n"; 110 echo "</tr>\n"; 111 112 echo "<tr>\n"; 113 echo "<table>\n"; 114 echo "<tr valign=top>\n"; 115 echo "<td> \n"; 116 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 117 echo "</td>\n"; 118 echo "<td>\n"; 119 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage); 120 echo "</td>\n"; 121 122 echo "<td> \n"; 123 $today = date("Y-m-d"); 124 showSummitData($gpc1db, $today); 125 echo "</td>\n"; 126 echo "</tr>\n"; 127 echo "</table>\n"; 128 129 echo "<table>\n"; 130 echo "<tr valign=top>\n"; 131 echo "<td> \n"; 132 echo "</td>\n"; 133 echo "<td>\n"; 134 if ($selectedServer) showServerStatus($selectedServer); 135 echo "</td>\n"; 136 echo "</tr>\n"; 137 echo "</table>\n"; 117 138 echo "</tr>\n"; 118 139 echo "</table>\n"; … … 203 224 # 204 225 ########################################################################### 205 function createLabelsTable($pass, $proj, $db, $s tdsLabels, $distLabels, $pubLabels, $stages, $states, $selectedState, $selectedLabel, $selectedStage, $selectedRevertStage, $currentRevertMode) {226 function createLabelsTable($pass, $proj, $db, $server, $labels, $distLabels, $pubLabels, $stages, $states, $selectedState, $selectedLabel, $selectedStage) { 206 227 207 228 // set up table columns … … 210 231 echo "<tr><td></td>\n"; 211 232 233 echo "<p align=\"center\"> Current labels for $server server </p>"; 234 212 235 write_header_cell($class, ""); 213 236 write_header_cell($class, ""); … … 215 238 foreach ($stages as &$stage) { 216 239 217 $revertOnOff=array(); 218 if ($stage == "destreak" or $stage == "dist") $server = "distribution"; 219 else $server = "stdscience"; 220 if ($stage == $selectedRevertStage) $reverting = $currentRevertMode; 221 else $reverting = getRevertStatus($db, $stage); 222 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&revertserver=" . $server . "&revertstage=" . $stage . "&revertmode="; 240 $reverting = getRevertStatus($db, $stage); 241 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&revertmode="; 223 242 if(!$reverting) {$label = "Start";$link = $link . "on";} 224 243 if($reverting) {$label = "Stop";$link = $link . "off";} … … 250 269 251 270 // write rows 252 foreach ($ stdsLabels as &$stdsLabel) {271 foreach ($labels as &$thisLabel) { 253 272 254 273 $distributing = false; … … 256 275 foreach ($distLabels as &$distLabel) { 257 276 258 if ($ stdsLabel == $distLabel) { $distributing = true; break;}277 if ($thisLabel == $distLabel) { $distributing = true; break;} 259 278 } 260 279 foreach ($pubLabels as &$pubLabel) { 261 280 262 if ($ stdsLabel == $pubLabel) { $publishing = true; break;}281 if ($thisLabel == $pubLabel) { $publishing = true; break;} 263 282 } 264 283 265 284 // create link to label summary page for each label 266 if ($ stdsLabel == $selectedLabel) $link = "";267 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $ stdsLabel . "&stage=" . $selectedStage;285 if ($thisLabel == $selectedLabel) $link = ""; 286 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $thisLabel . "&stage=" . $selectedStage; 268 287 269 288 echo "<tr><td></td>\n"; 270 write_table_cell($class, '%s', $link, $ stdsLabel);289 write_table_cell($class, '%s', $link, $thisLabel); 271 290 write_table_cell($class, '%s', "", $distributing ? "yes" : "NO"); 272 291 write_table_cell($class, '%s', "", $publishing ? "yes" : "NO"); … … 275 294 $anyFaults = false; 276 295 277 $link = " chipProcessedImfile_failure.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $stdsLabel . "&chipRun.state=new";278 getStateAndFaults($db, $ stdsLabel, $selectedState, "chip", $str, $anyFaults);296 $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state=new"; 297 getStateAndFaults($db, $thisLabel, $selectedState, "chip", $str, $anyFaults); 279 298 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 280 299 281 $link = " camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $stdsLabel . "&camRun.state=new";282 getStateAndFaults($db, $ stdsLabel, $selectedState, "cam", $str, $anyFaults);300 $link = "failedCamProcessedExp.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $thisLabel . "&camRun.state=new"; 301 getStateAndFaults($db, $thisLabel, $selectedState, "cam", $str, $anyFaults); 283 302 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 284 303 304 $link = "failedFakeProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&fakeRun.label=" . $thisLabel . "&fakeRun.state=new"; 305 getStateAndFaults($db, $thisLabel, $selectedState, "fake", $str, $anyFaults); 306 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 307 308 $link = "failedWarpSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $thisLabel . "&warpRun.state=new"; 309 getStateAndFaults($db, $thisLabel, $selectedState, "warp", $str, $anyFaults); 310 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 311 312 $link = "failedStackSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $thisLabel . "&stackRun.state=new"; 313 getStateAndFaults($db, $thisLabel, $selectedState, "stack", $str, $anyFaults); 314 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 315 316 $link = "failedDiffSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $thisLabel . "&diffRun.state=new"; 317 getStateAndFaults($db, $thisLabel, $selectedState, "diff", $str, $anyFaults); 318 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 319 285 320 $link = $defaultlink; 286 getStateAndFaults($db, $ stdsLabel, $selectedState, "fake", $str, $anyFaults);321 getStateAndFaults($db, $thisLabel, $selectedState, "magic", $str, $anyFaults); 287 322 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 288 323 289 $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $stdsLabel . "&warpRun.state=new"; 290 getStateAndFaults($db, $stdsLabel, $selectedState, "warp", $str, $anyFaults); 291 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 292 293 $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $stdsLabel . "&stackRun.state=new"; 294 getStateAndFaults($db, $stdsLabel, $selectedState, "stack", $str, $anyFaults); 324 $link = $defaultlink; 325 getStateAndFaults($db, $thisLabel, $selectedState, "magicDS", $str, $anyFaults); 295 326 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 296 327 297 $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $stdsLabel . "&diffRun.state=new";298 getStateAndFaults($db, $stdsLabel, $selectedState, "diff", $str, $anyFaults);299 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);300 301 328 $link = $defaultlink; 302 getStateAndFaults($db, $ stdsLabel, $selectedState, "magic", $str, $anyFaults);329 getStateAndFaults($db, $thisLabel, $selectedState, "dist", $str, $anyFaults); 303 330 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 304 331 305 $link = $defaultlink;306 getStateAndFaults($db, $stdsLabel, $selectedState, "magicDS", $str, $anyFaults);307 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);308 309 $link = $defaultlink;310 getStateAndFaults($db, $stdsLabel, $selectedState, "dist", $str, $anyFaults);311 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);312 313 332 echo "</tr>\n"; 314 333 } 315 334 316 if ($selectedLabel == "all_ labels") $link = "";317 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_ labels&stage=".$selectedStage;335 if ($selectedLabel == "all_".$server."_labels") $link = ""; 336 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage; 318 337 319 338 echo "<tr><td></td>\n"; 320 write_table_cell($class, '%s', $link, "All labels:"); 321 write_table_cell($class, '%s', "", "-"); 322 write_table_cell($class, '%s', "", "-"); 323 324 $str = ""; 325 $anyFaults = false; 326 327 $link = "chipProcessedImfile_failure.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.state=new"; 328 getStateAndFaults($db, "all_labels", $selectedState, "chip", $str, $anyFaults); 329 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 330 331 $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&camRun.state=new"; 332 getStateAndFaults($db, "all_labels", $selectedState, "cam", $str, $anyFaults); 333 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 334 335 $link = $defaultlink; 336 getStateAndFaults($db, "all_labels", $selectedState, "fake", $str, $anyFaults); 337 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 338 339 $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.state=new"; 340 getStateAndFaults($db, "all_labels", $selectedState, "warp", $str, $anyFaults); 341 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 342 343 $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.state=new"; 344 getStateAndFaults($db, "all_labels", $selectedState, "stack", $str, $anyFaults); 345 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 346 347 $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.state=new"; 348 getStateAndFaults($db, "all_labels", $selectedState, "diff", $str, $anyFaults); 349 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 350 351 $link = $defaultlink; 352 getStateAndFaults($db, "all_labels", $selectedState, "magic", $str, $anyFaults); 353 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 354 355 $link = $defaultlink; 356 getStateAndFaults($db, "all_labels", $selectedState, "magicDS", $str, $anyFaults); 357 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 358 359 $link = $defaultlink; 360 getStateAndFaults($db, "all_labels", $selectedState, "dist", $str, $anyFaults); 361 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 362 339 write_table_cell($class, '%s', $link, "All $server labels"); 363 340 364 341 echo "</tr>\n"; … … 368 345 ########################################################################### 369 346 # 347 # Sets reverts status 348 # 349 ########################################################################### 350 function setRevertStatus($db, $stage, $reverting) { 351 352 $sql = "UPDATE reverts SET reverting = $reverting WHERE stage LIKE '$stage'"; 353 if ($debug) {echo "$sql<br>";} 354 355 $qry = $db->query($sql); 356 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 357 } 358 359 ########################################################################### 360 # 370 361 # Returns whether this stage is reverting or not 371 362 # … … 374 365 375 366 $anyFaults = false; 376 $sql = "SELECT reverting FROM $stage ORDER BY timestamp DESC LIMIT 1"; 367 368 $sql = "SELECT reverting FROM reverts WHERE stage LIKE '$stage'"; 377 369 if ($debug) {echo "$sql<br>";} 378 370
Note:
See TracChangeset
for help on using the changeset viewer.
