- Timestamp:
- Oct 21, 2010, 2:45:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823/ippMonitor/raw/czartool_labels.php
r29124 r29515 25 25 26 26 menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']); 27 28 $pass = $ID['pass'];29 $proj = $ID['proj'];30 $menu = $ID['menu'];31 32 $selectedStage = $_GET[stage];33 $selectedLabel = $_GET[label];34 $selectedServer = $_GET[server];35 $selectedRevertStage = $_GET[revertstage];36 $selectedRevertMode = $_GET[revertmode];37 38 if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; }39 if ($selectedStage == "") { $selectedStage = "all_stages"; }40 41 $nsStatus = getNightlyScienceStatus($czardb);42 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus</p>";43 44 45 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later46 if ($selectedRevertStage != "" && $selectedRevertMode != "") {47 48 exec("czartool_revert.pl -t $selectedRevertStage -o $selectedRevertMode", $response, $status);49 $currentRevertMode;50 if ($response[0] == "off") $currentRevertMode = 0;51 else if ($response[0] == "on") $currentRevertMode = 1;52 53 setRevertStatus($czardb, $selectedRevertStage, $currentRevertMode);54 }55 $debug = 0;56 57 $stdsLabels = getLabels($czardb, "stdscience");58 $distLabels = getLabels($czardb, "distribution");59 $pubLabels = getLabels($czardb, "publishing");60 $updateLabels = getLabels($czardb, "update");61 62 if ($debug) {63 echo "prog returned $status, and output:<br>";64 for ($i = 0; $i < count($distLabels); $i++) {65 echo "$distLabels[$i]<br>";66 }67 }68 27 69 28 $states=array("full","new","drop","wait"); … … 82 41 "summitcopy"); 83 42 43 $pass = $ID['pass']; 44 $proj = $ID['proj']; 45 $menu = $ID['menu']; 46 47 $selectedStage = $_GET[stage]; 48 $selectedLabel = $_GET[label]; 49 $selectedServer = $_GET[server]; 50 $selectedRevertStage = $_GET[revertstage]; 51 $selectedRevertMode = $_GET[revertmode]; 52 $plotType = $_GET[plottype]; 53 $serverCmd = $_GET[servercmd]; 54 $allServerCmd = $_GET[allservercmd]; 55 56 if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; } 57 if ($selectedStage == "") { $selectedStage = "all_stages"; } 58 if ($plotType == "") { $plotType = "linear"; } 59 60 $nsStatus = getNightlyScienceStatus($czardb); 61 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 62 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 63 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots </p>"; 64 65 66 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later 67 if ($selectedRevertStage && $selectedRevertMode) turnRevertsOnOff($czardb, $selectedRevertStage, $selectedRevertMode); 68 69 // tell selected server to stop or run 70 if ($selectedServer && $serverCmd) serverStopRun($czardb, $selectedServer, $serverCmd); 71 72 // tell all servers to stop or run 73 if ($allServerCmd) { 74 75 foreach ($servers as &$server) serverStopRun($czardb, $server, $allServerCmd); 76 } 77 78 79 $debug = 0; 80 81 $stdsLabels = getLabels($czardb, "stdscience"); 82 $distLabels = getLabels($czardb, "distribution"); 83 $pubLabels = getLabels($czardb, "publishing"); 84 $updateLabels = getLabels($czardb, "update"); 85 86 if ($debug) { 87 echo "prog returned $status, and output:<br>"; 88 for ($i = 0; $i < count($distLabels); $i++) { 89 echo "$distLabels[$i]<br>"; 90 } 91 } 92 93 84 94 // set up the form 85 95 echo "<form action=\"czartool_labels.php\" method=\"POST\">\n"; … … 91 101 92 102 echo "<table>\n"; 93 echo "<tr>\n";94 echo "<td>\n";95 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage\"><br>";96 echo "</td>\n";97 98 echo "<td> \n";99 createLabelsTable($pass, $proj, $czardb, "stdscience", $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage);100 echo "</td>\n";101 echo "</tr>\n";102 103 echo "<tr>\n";104 echo "<td>\n";105 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage\"><br>";106 echo "</td>\n";107 108 echo "<td> \n";109 createLabelsTable($pass, $proj, $czardb, "update", $updateLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage);110 echo "</td>\n";111 echo "</tr>\n";112 113 echo "<tr>\n";114 echo "<table>\n";115 echo "<tr valign=top>\n";116 echo "<td> \n";117 echo "<img src=\"czartool_getplot.php?type=s\"><br>";118 echo "</td>\n";119 echo "<td>\n";120 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage);121 echo "</td>\n";122 123 echo "<td> \n";124 $today = date("Y-m-d");125 showSummitData($gpc1db, $today);126 echo "</td>\n";127 echo "</tr>\n";128 echo "</table>\n";129 130 echo "<table>\n";131 echo "<tr valign=top>\n";132 echo "<td> \n";133 echo "</td>\n";134 echo "<td>\n";135 if ($selectedServer) showServerStatus($selectedServer);136 echo "</td>\n";137 echo "</tr>\n";138 echo "</table>\n";139 echo "</tr>\n";103 echo "<tr>\n"; 104 echo "<td>\n"; 105 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>"; 106 echo "</td>\n"; 107 108 echo "<td> \n"; 109 createLabelsTable($pass, $proj, $czardb, "stdscience", $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage, $plotType); 110 echo "</td>\n"; 111 echo "</tr>\n"; 112 113 echo "<tr>\n"; 114 echo "<td>\n"; 115 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 116 echo "</td>\n"; 117 118 echo "<td> \n"; 119 createLabelsTable($pass, $proj, $czardb, "update", $updateLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage, $plotType); 120 echo "</td>\n"; 121 echo "</tr>\n"; 122 123 echo "<tr>\n"; 124 echo "<table>\n"; 125 echo "<tr valign=top>\n"; 126 echo "<td> \n"; 127 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 128 echo "</td>\n"; 129 echo "<td>\n"; 130 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 131 echo "</td>\n"; 132 133 echo "<td> \n"; 134 $today = date("Y-m-d"); 135 showSummitData($gpc1db, $today); 136 echo "</td>\n"; 137 echo "</tr>\n"; 138 echo "</table>\n"; 139 140 echo "<table>\n"; 141 echo "<tr valign=top>\n"; 142 echo "<td> \n"; 143 echo "</td>\n"; 144 echo "<td>\n"; 145 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 146 echo "</td>\n"; 147 echo "</tr>\n"; 148 echo "</table>\n"; 149 echo "</tr>\n"; 140 150 echo "</table>\n"; 141 151 … … 225 235 # 226 236 ########################################################################### 227 function createLabelsTable($pass, $proj, $db, $server, $labels, $distLabels, $pubLabels, $stages, $states, $selectedState, $selectedLabel, $selectedStage) { 237 function createLabelsTable( 238 $pass, 239 $proj, 240 $db, 241 $server, 242 $labels, 243 $distLabels, 244 $pubLabels, 245 $stages, 246 $states, 247 $selectedState, 248 $selectedLabel, $selectedStage, $plotType) { 228 249 229 250 // set up table columns … … 241 262 if ($stage == "burntool") continue; 242 263 $reverting = getRevertStatus($db, $stage); 243 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&revertmode="; 264 $link = 265 "czartool_labels.php?pass=".$pass 266 ."&proj=".$proj 267 ."&label=".$selectedLabel 268 ."&stage=".$selectedStage 269 ."&plottype=".$plotType 270 ."&revertstage=".$stage 271 ."&revertmode="; 272 244 273 if(!$reverting) {$label = "Start";$link = $link . "on";} 245 274 if($reverting) {$label = "Stop";$link = $link . "off";} … … 254 283 write_header_cell($class, "Label (in order of priority)"); 255 284 foreach ($stages as &$stage) { 256 285 257 286 if ($stage == $selectedStage) $link = ""; 258 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $stage; 287 else $link = 288 "czartool_labels.php?pass=".$pass 289 ."&proj=".$proj 290 ."&label=".$selectedLabel 291 ."&stage=".$stage 292 ."&plottype=".$plotType; 293 259 294 write_table_cell($class, '%s', $link, $stage); 260 295 } 261 296 262 297 if ($selectedStage=="all_stages") $link = ""; 263 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=all_stages"; 298 else $link = 299 "czartool_labels.php?pass=".$pass 300 ."&proj=".$proj 301 ."&label=".$selectedLabel 302 ."&stage=all_stages" 303 ."&plottype=".$plotType; 304 264 305 write_table_cell($class, '%s', $link, "All stages"); 265 306 … … 267 308 echo "<tr><td></td>\n"; 268 309 269 $defaultlink = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj; 310 $defaultlink = 311 "czartool_labels.php?pass=".$pass 312 ."&proj=".$proj 313 ."&label=".$selectedLabel 314 ."&stage=".$selectedStage 315 ."&plottype=".$plotType; 270 316 271 317 // write rows … … 285 331 // create link to label summary page for each label 286 332 if ($thisLabel == $selectedLabel) $link = ""; 287 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $thisLabel . "&stage=" . $selectedStage; 333 else $link = 334 "czartool_labels.php?pass=".$pass 335 ."&proj=".$proj 336 ."&label=".$thisLabel 337 ."&stage=".$selectedStage 338 ."&plottype=".$plotType; 288 339 289 340 echo "<tr><td></td>\n"; … … 342 393 343 394 if ($selectedLabel == "all_".$server."_labels") $link = ""; 344 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage ;395 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType; 345 396 346 397 echo "<tr><td></td>\n"; … … 385 436 ########################################################################### 386 437 # 438 # Turns reverts on or off for a given task 439 # 440 ########################################################################### 441 function turnRevertsOnOff($db, $stage, $mode) { 442 443 exec("czartool_revert.pl -t $stage -o $mode", $response, $status); 444 $currentRevertMode; 445 if ($response[0] == "off") $currentRevertMode = 0; 446 else if ($response[0] == "on") $currentRevertMode = 1; 447 448 setRevertStatus($db, $stage, $currentRevertMode); 449 } 450 451 ########################################################################### 452 # 387 453 # Returns whether this stage is reverting or not 388 454 # … … 420 486 $faults = $row[1]; 421 487 422 $str = "$pending"; 488 if ($pending == 0) 489 $str = ""; 490 else 491 $str = "$pending"; 423 492 424 493 if ($state == "new") { … … 437 506 # 438 507 ########################################################################### 439 function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage ) {508 function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 440 509 441 510 // set up table columns … … 445 514 write_header_cell($class, "Server"); 446 515 write_header_cell($class, "Alive?"); 447 write_header_cell($class, "Scheduler running?"); 516 $link = "czartool_labels.php?pass=".$pass 517 ."&proj=".$proj 518 ."&label=".$selectedLabel 519 ."&stage=".$selectedStage 520 ."&plottype=".$plotType 521 ."&allservercmd=stop"; 522 523 write_table_cell($class, '%s', $link, "Stop all"); 524 $link = "czartool_labels.php?pass=".$pass 525 ."&proj=".$proj 526 ."&label=".$selectedLabel 527 ."&stage=".$selectedStage 528 ."&plottype=".$plotType 529 ."&allservercmd=run"; 530 531 write_table_cell($class, '%s', $link, "Run all"); 448 532 echo "</tr>\n"; 449 533 450 534 foreach ($servers as &$server) { 451 535 452 $link = "czartool_labels.php?pass=".$pass."&proj=".$proj."&server=".$server."&label=".$selectedLabel."&stage=".$selectedStage;453 // $link = "";454 455 536 getServerStatus($db, $server, $alive, $running); 456 537 457 538 echo "<tr><td></td>\n"; 539 $link = "czartool_labels.php?pass=".$pass 540 ."&proj=".$proj 541 ."&server=".$server 542 ."&label=".$selectedLabel 543 ."&stage=".$selectedStage 544 ."&plottype=".$plotType; 545 458 546 write_table_cell($class, '%s', $link, $server); 459 547 write_table_cell($class, '%s', "", $alive ? "yes" : "NO"); 460 write_table_cell($class, '%s', "", $running ? "yes" : "NO"); 548 549 if ($alive) { 550 551 $link = "czartool_labels.php?pass=".$pass 552 ."&proj=".$proj 553 ."&label=".$selectedLabel 554 ."&stage=".$selectedStage 555 ."&plottype=".$plotType 556 ."&server=".$server 557 ."&servercmd="; 558 559 if ($running) { 560 561 $link = $link . "stop"; 562 write_table_cell($class, '%s', $link, "stop"); 563 write_table_cell($class, '%s', "", ""); 564 } 565 else { 566 567 $link = $link . "run"; 568 write_table_cell($class, '%s', "", ""); 569 write_table_cell($class, '%s', $link, "run"); 570 } 571 } 572 else { 573 574 write_table_cell($class, '%s', "", ""); 575 write_table_cell($class, '%s', "", ""); 576 } 461 577 echo "</tr>\n"; 462 578 } … … 464 580 echo "</table>\n"; 465 581 } 582 583 ########################################################################### 584 # 585 # Commands a server to stop or run 586 # 587 ########################################################################### 588 function serverStopRun($db, $server, $cmd) { 589 590 exec("czartool_serverstoprun.pl -s $server -c $cmd", $response, $status); 591 $alive = 0; 592 $running = 0; 593 if ($response[0] == "running") {$alive = 1; $running = 1;} 594 else if ($response[0] == "stopped") {$alive = 1; $running = 0;} 595 else if ($response[0] == "dead") {$alive = 0; $running = 0;} 596 setServerStatus($db, $server, $alive, $running); 597 } 598 599 ########################################################################### 600 # 601 # Sets server status 602 # 603 ########################################################################### 604 function setServerStatus($db, $server, $alive, $running) { 605 606 $sql = "INSERT INTO servers (server, alive, running) VALUES ('$server', $alive, $running)"; 607 608 if ($debug) {echo "$sql<br>";} 609 610 $qry = $db->query($sql); 611 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 612 } 613 466 614 467 615 ###########################################################################
Note:
See TracChangeset
for help on using the changeset viewer.
