- Timestamp:
- Mar 30, 2011, 9:36:02 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ippMonitor/raw/czartool_labels.php
r30812 r31083 14 14 $gpc1db = dbconnect($ID['proj']); 15 15 16 16 17 $PATH = getenv("PATH"); 17 18 putenv("PATH=$BINDIR:$PATH"); … … 27 28 28 29 $states=array("full","new","drop","wait"); 29 $stages=array("burntool", "chip","cam","fake","warp","stack","diff","magic","magicDS","dist" );30 $stages=array("burntool", "chip","cam","fake","warp","stack","diff","magic","magicDS","dist", "pub"); 30 31 $servers=array( 31 32 "addstar", … … 58 59 if ($plotType == "") { $plotType = "linear"; } 59 60 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>Current ippMonitor SVN version: ";64 include 'version.php';65 echo "</p>";66 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots <br/><a href=\"http://ipp004.ifa.hawaii.edu/clusterMonitor/top.html\">Who uses the cluster?</a><br><a href=\"http://ipp004.ifa.hawaii.edu/ippMetrics\">IPP Metrics</a><br/><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\">Czar log pages</a><br><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\">Exposure summary</a></p>";67 68 61 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later 69 62 if ($selectedRevertStage && $selectedRevertMode) turnRevertsOnOff($czardb, $selectedRevertStage, $selectedRevertMode); … … 102 95 echo "</form>\n"; 103 96 104 echo "<table>\n"; 105 106 107 # 1st row 108 echo "<tr>\n"; 109 echo "<td> \n"; 110 echo "<table>\n"; 111 echo "<tr valign=center>\n"; 112 echo "<td> \n"; 113 # timeseries plot 114 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>"; 115 echo "</td>\n"; 116 echo "<td>\n"; 117 createLabelsTable($pass, 118 $proj, 119 $czardb, 120 "stdscience", 121 $stdsLabels, 122 $distLabels, 123 $pubLabels, 124 $stages, 125 $states, 126 "new", 127 $selectedLabel, 128 $selectedStage, 129 $plotType); 130 echo "</td>\n"; 131 echo "</tr>\n"; 132 echo "</table>\n"; 133 echo "</td> \n"; 134 echo "</tr>\n"; 135 136 137 138 # 2nd row 139 echo "<tr>\n"; 140 echo "<td> \n"; 141 echo "<table>\n"; 142 echo "<tr valign=center>\n"; 143 echo "<td> \n"; 144 # rate plot 145 echo "<img src=\"czartool_getplot.php?type=r&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 146 echo "</td>\n"; 147 echo "<td>\n"; 148 createLabelsTable($pass, 149 $proj, 150 $czardb, 151 "update", 152 $updateLabels, 153 $distLabels, 154 $pubLabels, 155 $stages, 156 $states, 157 "new", 158 $selectedLabel, 159 $selectedStage, 160 $plotType); 161 echo "</td>\n"; 162 echo "</tr>\n"; 163 echo "</table>\n"; 164 echo "</td> \n"; 165 echo "</tr>\n"; 166 167 168 # 3rd row 169 echo "<tr>\n"; 170 echo "<td> \n"; 171 echo "<table>\n"; 172 echo "<tr valign=top>\n"; 173 echo "<td> \n"; 174 # histogram plot 175 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 176 echo "</td>\n"; 177 echo "<td>\n"; 178 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 179 echo "</td>\n"; 180 181 echo "<td> \n"; 182 $today = date("Y-m-d"); 183 createSummitDataTable($gpc1db, $today); 184 echo "</td>\n"; 185 echo "</tr>\n"; 186 echo "</table>\n"; 187 echo "</td> \n"; 188 echo "</tr>\n"; 189 190 # 4th row 191 echo "<tr>\n"; 192 echo "<td> \n"; 193 echo "<table>\n"; 194 echo "<tr valign=top>\n"; 195 echo "<td> \n"; 196 # storage plot 197 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 198 echo "</td>\n"; 199 echo "<td>\n"; 200 createDatesTable($czardb); 201 echo "</td>\n"; 202 echo "</tr>\n"; 203 echo "</table>\n"; 204 echo "</td> \n"; 205 echo "</tr>\n"; 206 207 # 5th row 208 echo "<tr>\n"; 209 echo "<td>\n"; 210 echo "<table>\n"; 211 echo "<tr valign=top>\n"; 212 echo "<td> \n"; 213 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 214 echo "</td>\n"; 215 echo "<td>\n"; 216 # This is awful 217 echo "<table border=\"1\"><tr><td colspan=\"2\"><b>Databases Replication Status</b></td></tr>"; 218 echo "<tr><td colspan=\"2\">Update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a></td></tr>"; 219 echo "<tr><td>Database</td><td>Replication Status</td></tr>"; 220 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 221 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 222 showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); 223 echo "</table>"; 224 echo "</td>\n"; 225 echo "</tr>\n"; 226 echo "</table>\n"; 227 echo "</td> \n"; 228 echo "</tr>\n"; 229 230 echo "</table>\n"; 97 echo "<table border=\"0\">"; 98 99 echo "<tr>"; 100 echo "<td colspan=\"2\" style=\"background-color:#0080c0;\">"; 101 echo "<h1 align=\"middle\">Czartool</h1>"; 102 echo "</td>"; 103 echo "</tr>"; 104 105 echo "<tr valign=\"top\">"; 106 echo "<td style=\"background-color:#EEEEEE;width:100px;text-align:top;\">"; 107 # time series plot 108 echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>"; 109 # rate time series plot 110 echo "<img src=\"czartool_getplot.php?type=rt&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 111 # rate stacked histo plot 112 echo "<img src=\"czartool_getplot.php?type=rh&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 113 # histogram plot 114 echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>"; 115 # storage timeseries 116 echo "<img src=\"czartool_getplot.php?type=st\"><br>"; 117 # storage plot 118 echo "<img src=\"czartool_getplot.php?type=s\"><br>"; 119 # pantasks server status, if requested 120 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 121 echo "</td>"; 122 echo "<td style=\"background-color:#EEEEEE;height:200px;width:400px;text-align:top;\">"; 123 124 echo "<br><br>"; 125 126 // status table at top 127 $nsStatus = getNightlyScienceStatus($czardb); 128 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 129 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 130 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 131 echo "<tr>\n"; 132 echo "<tr><td>Time of last update</td><td>$lastUpdateTime</td></tr>"; 133 echo "<tr><td>ippMonitor SVN version</td><td>"; include 'version.php'; echo "</td></tr>"; 134 echo "<tr><td>Current nightly science status</td><td>$nsStatus</td></tr>"; 135 echo "<tr><td>Postage stamp server status</td><td><a href=\"http://pstamp.ipp.ifa.hawaii.edu/status.php\"><font color=\"blue\">here</font></a></td></tr>"; 136 echo "<tr><td>Documentation</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\"><font color=\"blue\">here</font></a></td></tr>"; 137 echo "<tr><td>Cluster load</td><td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\"><font color=\"blue\">here</font></a></td></tr>"; 138 echo "<tr><td>Who's using the cluster?</td><td><a href=\"http://ipp004.ifa.hawaii.edu/clusterMonitor/top.html\"><font color=\"blue\">here</font></a></td></tr>"; 139 echo "<tr><td>IPP metrics</td><td><a href=\"http://ipp004.ifa.hawaii.edu/ippMetrics\"><font color=\"blue\">here</font></a></td></tr>"; 140 echo "<tr><td>Czar log pages</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\"><font color=\"blue\">here</font></a></td></tr>"; 141 echo "<tr><td>Exposure summary</td><td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>"; 142 echo "</table>\n"; 143 144 echo "<br><br>"; 145 146 createLabelsTable($pass, 147 $proj, 148 $czardb, 149 "stdscience", 150 $stdsLabels, 151 $distLabels, 152 $pubLabels, 153 $stages, 154 $states, 155 "new", 156 $selectedLabel, 157 $selectedStage, 158 $plotType); 159 160 echo "<br><br>"; 161 createLabelsTable($pass, 162 $proj, 163 $czardb, 164 "update", 165 $updateLabels, 166 $distLabels, 167 $pubLabels, 168 $stages, 169 $states, 170 "new", 171 $selectedLabel, 172 $selectedStage, 173 $plotType); 174 echo "<br><br>"; 175 createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 176 echo "<br><br>"; 177 createSummitDataTable($gpc1db); 178 echo "<br><br>"; 179 createDatesTable($czardb); 180 echo "<br><br>"; 181 createPStampDataTable(); 182 echo "<br><br>"; 183 # This is awful 184 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 185 echo "<tr>"; 186 echo "<th colspan=\"2\">Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)</th>"; 187 echo "<tr>"; 188 echo "<th>Database</th>"; 189 echo "<th>Status</th>"; 190 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 191 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 192 showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); 193 echo "</table>"; 194 195 echo "</table>"; 231 196 232 197 menu_end(); … … 235 200 ########################################################################### 236 201 # 202 # Creates a postage stamp status table 203 # 204 ########################################################################### 205 function createPStampDataTable() { 206 207 $sql = "SELECT label, COUNT(job_id) AS 'Unfinished Jobs', IFNULL(priority,10000) AS priority FROM pstampRequest JOIN pstampJob USING(req_id) LEFT JOIN Label USING(label) WHERE pstampJob.state ='run' and pstampRequest.state ='run' GROUP by label"; 208 209 $pstampdb = DB::connect("mysql://ippuser:ippuser@ippc17/ippRequestServer"); 210 $qry = $pstampdb->query($sql); 211 if (dberror($qry)) { 212 echo "<b>error reading pstamp table</b><br>\n"; 213 echo "<br><small><b> table query : $sql </b></small><br>\n"; 214 menu_end(); 215 } 216 217 // set up the table 218 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 219 echo "<tr>"; 220 echo "<th colspan=\"3\">Postage stamp requests</th>"; 221 echo "<tr>"; 222 echo "<th>Label</th>"; 223 echo "<th>Unfinished jobs</th>"; 224 echo "<th>Priority</th>"; 225 226 // list the results 227 while ($qry->fetchInto($row)) { 228 229 echo "<tr>"; 230 231 echo "<td>$row[0]</td>"; 232 echo "<td>$row[1]</td>"; 233 echo "<td>$row[2]</td>"; 234 235 echo "</tr>"; 236 } 237 238 echo "</table>\n"; 239 240 } 241 242 ########################################################################### 243 # 237 244 # Creates a table of summitExp against rawExp 238 245 # 239 246 ########################################################################### 240 function createSummitDataTable($gpc1db, $date) { 241 247 function createSummitDataTable($gpc1db) { 248 249 $date = date("Y-m-d"); 242 250 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 243 251 … … 250 258 251 259 // set up the table 252 echo "<table class=list>\n"; 253 echo "<tr><td></td>\n"; 254 write_header_cell ("list", "Exposure type"); 255 write_header_cell ("list", "At summit"); 256 write_header_cell ("list", "Registered at MHPCC"); 260 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 261 echo "<tr>"; 262 echo "<th colspan=\"3\">Status of last night's data</th>"; 263 echo "<tr>"; 264 echo "<th>Exposure type</th>"; 265 echo "<th>At summit</th>"; 266 echo "<th>Registered at MHPCC</th>"; 257 267 258 268 $msg = "No science images taken since $date"; … … 268 278 $qry2->fetchInto($mhpcc); 269 279 270 $class = "list"; 271 echo "<tr><td></td>\n"; 272 273 if ($expType[0] == "OBJECT") { 274 if ($summit[0] == $mhpcc[0]) { 275 $msg = "All science exposures taken since $date<br>have been registered at MHPCC"; 276 } 277 else { 278 $msg = "<font color=\"orange\">Warning: Not all science exposures taken since $date<br>have been registered at MHPCC</a>"; 279 } 280 echo "<tr>"; 281 282 if ($summit[0] == $mhpcc[0]) { 283 284 if ($expType[0] == "OBJECT") $msg = "All science exposures taken since $date<br>have been registered at MHPCC"; 285 $error = 0; 280 286 } 281 282 write_table_cell ($class, '%s', "", $expType[0]); 283 write_table_cell ($class, '%d', "", $summit[0]); 284 write_table_cell ($class, '%d', $link, $mhpcc[0]); 285 echo "</tr>\n"; 286 } 287 287 else { 288 if ($expType[0] == "OBJECT") $msg = "<font color=\"red\">Warning: Not all science exposures taken since $date<br>have been registered at MHPCC</a>"; 289 $error = 1; 290 } 291 292 echo "<td>$expType[0]</td>"; 293 echo "<td>$summit[0]</td>"; 294 295 296 297 #echo "<td bgcolor=\"$color\">$mhpcc[0]</td>"; 298 createFormattedTableCell("", "", $mhpcc[0], $error); 299 300 echo "</tr>"; 301 } 302 303 echo "<td colspan=\"3\">$msg</td>"; 288 304 echo "</table>\n"; 289 290 echo "<p> $msg </p>";291 305 292 306 } … … 331 345 $selectedLabel, $selectedStage, $plotType) { 332 346 333 // set up table columns 334 $class = "list"; 335 echo "<table class=$class >\n"; 336 echo "<tr><td></td>\n"; 337 338 echo "<p align=\"center\"> Current labels for $server server (D=distributing, P=publishing)</p>"; 339 340 write_header_cell($class, ""); 341 write_header_cell($class, ""); 342 write_header_cell($class, "Reverts:"); 347 // setup table 348 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 349 echo "<tr>\n"; 350 echo "<th colspan=\"13\">"; 351 352 $link = "czartool_labels.php?pass=".$pass 353 ."&proj=".$proj 354 ."&label=".$selectedLabel 355 ."&stage=all_stages" 356 ."&plottype=".$plotType; 357 if ($selectedStage != "all_stages") echo "<a href=\"$link\"><font color=\"blue\">"; 358 else echo "<a><font color=\"black\">"; 359 echo "Plot all stages</font></a> | "; 360 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType; 361 echo "<a "; 362 if ($selectedLabel != "all_".$server."_labels") echo "<a href=\"$link\"><font color=\"blue\">"; 363 else echo "<a><font color=\"black\">"; 364 echo "Plot all ".$server."_labels</a> | "; 365 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 366 $plotTypeText = ($plotType == "linear") ? "Use log plots" : "Use linear plots"; 367 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 368 echo "<a href=\"$link\"><font color=\"blue\">$plotTypeText</font></a>"; 369 370 371 echo "</th>"; 372 echo "</tr>\n"; 373 374 echo "<tr>\n"; 375 //echo "<th></th>"; 376 echo "<th colspan=\"2\">$server server</th>"; 377 echo "<th>Reverts:</th>"; 378 343 379 foreach ($stages as &$stage) { 344 380 … … 357 393 if($reverting) {$label = "Stop";$link = $link . "off";} 358 394 unset($reverting); 359 write_table_cell($class, '%s', $link, $label);360 } 361 write_header_cell($class, "");395 echo "<td><a href=\"$link\"><font color=\"blue\">$label</font></td>"; 396 397 } 362 398 363 399 echo "</tr>\n"; 364 echo "<tr> <td></td>\n";365 write_header_cell($class, " ");366 write_header_cell($class, "Label (in order of priority)");400 echo "<tr>\n"; 401 //echo "<th> </th>"; 402 echo "<th colspan=\"2\">Label (in order of priority)</th>"; 367 403 foreach ($stages as &$stage) { 368 404 369 if ($stage == $selectedStage) $link = ""; 370 else $link = 405 if ($stage == $selectedStage) $showLink = 0; 406 else $showLink = 1; 407 $link = 371 408 "czartool_labels.php?pass=".$pass 372 ."&proj=".$proj 373 ."&label=".$selectedLabel 374 ."&stage=".$stage 375 ."&plottype=".$plotType; 376 377 write_table_cell($class, '%s', $link, $stage); 378 } 379 380 if ($selectedStage=="all_stages") $link = ""; 381 else $link = 382 "czartool_labels.php?pass=".$pass 383 ."&proj=".$proj 409 ."&proj=".$proj 384 410 ."&label=".$selectedLabel 385 ."&stage= all_stages"411 ."&stage=".$stage 386 412 ."&plottype=".$plotType; 387 413 388 write_table_cell($class, '%s', $link, "All stages");389 390 echo "</tr>\n"; 391 echo "<tr><td></td>\n"; 392 414 createFormattedTableCell($showLink, $link, $stage, 0); 415 } 416 417 418 // setup default link 393 419 $defaultlink = 394 420 "czartool_labels.php?pass=".$pass … … 415 441 } 416 442 417 // create link to label summary page for each label 418 if ($thisLabel == $selectedLabel) $link = ""; 419 else $link = 420 "czartool_labels.php?pass=".$pass 421 ."&proj=".$proj 422 ."&label=".$thisLabel 423 ."&stage=".$selectedStage 424 ."&plottype=".$plotType; 425 426 echo "<tr><td></td>\n"; 427 $distPub = " "; 443 // show distribution/publishing status 444 echo "<tr>\n"; 445 $distPub = " "; 428 446 if ($distributing) $distPub = "D"; 429 447 if ($publishing) $distPub = $distPub . "P"; 430 write_table_cell($class, '%s', "", $distPub); 431 432 write_table_cell($class, '%s', $link, $thisLabel); 448 echo "<td>$distPub</td>"; 449 450 // create link to label summary page for each label 451 if ($thisLabel == $selectedLabel) $showLink = 0; 452 else $showLink = 1; 453 $link = 454 "czartool_labels.php?pass=".$pass 455 ."&proj=".$proj 456 ."&label=".$thisLabel 457 ."&stage=".$selectedStage 458 ."&plottype=".$plotType; 459 createFormattedTableCell($showLink, $link, $thisLabel, 0); 433 460 434 461 $str = ""; … … 437 464 $link = $defaultlink; 438 465 getStateAndFaults($db, $thisLabel, $selectedState, "burntool", $str, $anyFaults); 439 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);466 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 440 467 441 468 $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state=".$searchState; 442 469 getStateAndFaults($db, $thisLabel, $selectedState, "chip", $str, $anyFaults); 443 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);470 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 444 471 445 472 $link = "failedCamProcessedExp.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $thisLabel . "&camRun.state=".$searchState; 446 473 getStateAndFaults($db, $thisLabel, $selectedState, "cam", $str, $anyFaults); 447 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);474 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 448 475 449 476 $link = "failedFakeProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&fakeRun.label=" . $thisLabel . "&fakeRun.state=".$searchState; 450 477 getStateAndFaults($db, $thisLabel, $selectedState, "fake", $str, $anyFaults); 451 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);478 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 452 479 453 480 $link = "failedWarpSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $thisLabel . "&warpRun.state=".$searchState; 454 481 getStateAndFaults($db, $thisLabel, $selectedState, "warp", $str, $anyFaults); 455 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);482 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 456 483 457 484 $link = "failedStackSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $thisLabel . "&stackRun.state=".$searchState; 458 485 getStateAndFaults($db, $thisLabel, $selectedState, "stack", $str, $anyFaults); 459 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);486 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 460 487 461 488 $link = "failedDiffSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $thisLabel . "&diffRun.state=".$searchState; 462 489 getStateAndFaults($db, $thisLabel, $selectedState, "diff", $str, $anyFaults); 463 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);490 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 464 491 465 492 $link = $defaultlink; 466 493 getStateAndFaults($db, $thisLabel, $selectedState, "magic", $str, $anyFaults); 467 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);494 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 468 495 469 496 $link = $defaultlink; 470 497 getStateAndFaults($db, $thisLabel, $selectedState, "magicDS", $str, $anyFaults); 471 write_table_cell($class, '%s', $anyFaults ? $link : "", $str);498 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 472 499 473 500 $link = $defaultlink; 474 501 getStateAndFaults($db, $thisLabel, $selectedState, "dist", $str, $anyFaults); 475 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 502 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 503 504 $link = "publishDone.php?pass=" . $pass . "&proj=" . $proj . "&publishRun.label=" . $thisLabel . "&publishRun.state=".$searchState; 505 getStateAndFaults($db, $thisLabel, $selectedState, "pub", $str, $anyFaults); 506 createFormattedTableCell($anyFaults, $link, $str, $anyFaults); 476 507 477 508 echo "</tr>\n"; 478 509 } 479 510 480 if ($selectedLabel == "all_".$server."_labels") $link = ""; 481 else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType; 482 483 echo "<tr><td></td>\n"; 484 write_table_cell($class, '%s', "", " "); 485 write_table_cell($class, '%s', $link, "All $server labels"); 511 if ($selectedLabel == "all_".$server."_labels") $showLink = 0; 512 else $showLink = 1; 513 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType; 486 514 487 515 echo "</tr>\n"; 488 516 echo "</table>\n"; 517 } 518 519 520 ########################################################################### 521 # 522 # Creates table cell with a red background if an error 523 # 524 ########################################################################### 525 function createFormattedTableCell($showLink, $link, $str, $error) { 526 527 $fontColor = $error ? "black" : "blue"; 528 529 if ($error) echo "<td bgcolor=\"red\">"; 530 else echo "<td>"; 531 if ($showLink) echo "<a href=\"$link\"><font color=\"$fontColor\">$str</font></td>"; 532 else if ($str) echo "$str</td>"; 533 else echo " </td>"; 489 534 } 490 535 … … 594 639 function createDatesTable($db) { 595 640 596 $class = "list"; 597 echo "<table class=$class>\n"; 598 echo "<tr><td></td>\n"; 599 write_header_cell($class, "Server"); 600 write_header_cell($class, "Dates"); 641 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 642 echo "<tr>\n"; 643 echo "<th colspan=\"3\">Current dates for selected pantasks servers</th>"; 644 echo "<tr>\n"; 645 echo "<th>Server</th>"; 646 echo "<th>Dates</th>"; 601 647 echo "</tr>\n"; 602 648 … … 632 678 } 633 679 634 $class = "list"; 635 echo "<tr><td></td>\n"; 636 write_table_cell($class, '%s', "", $server); 637 write_table_cell($class, '%s', "", $dates); 680 echo "<tr>"; 681 echo "<td>$server</td>"; 682 echo "<td>$dates</td>"; 683 echo "</tr>"; 684 685 } 686 687 ########################################################################### 688 # 689 # Checks the status of all the pantasks servers 690 # 691 ########################################################################### 692 function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 693 694 // set up table columns 695 echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; 696 echo "<tr>"; 697 echo "<th colspan=\"3\">Pantasks server status</th>"; 698 echo "<tr>"; 699 echo "<th>Server</th>"; 700 echo "<th>Alive?</th>"; 701 echo "<th>Running?</th>"; 702 703 //write_header_cell($class, "Server"); 704 //write_header_cell($class, "Alive?"); 705 //$link = "czartool_labels.php?pass=".$pass 706 // ."&proj=".$proj 707 // ."&label=".$selectedLabel 708 // ."&stage=".$selectedStage 709 // ."&plottype=".$plotType 710 // ."&allservercmd=stop"; 711 712 //$link = ""; # TODO removed links temporarily 713 // write_table_cell($class, '%s', $link, "Stop all"); 714 //$link = "czartool_labels.php?pass=".$pass 715 // ."&proj=".$proj 716 // ."&label=".$selectedLabel 717 // ."&stage=".$selectedStage 718 // ."&plottype=".$plotType 719 // ."&allservercmd=run"; 720 721 //$link = ""; # TODO removed links temporarily 722 // write_table_cell($class, '%s', $link, "Run all"); 638 723 echo "</tr>\n"; 639 724 640 }641 642 ###########################################################################643 #644 # Checks the status of all the pantasks servers645 #646 ###########################################################################647 function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage, $plotType) {648 649 // set up table columns650 $class = "list";651 echo "<table class=$class>\n";652 echo "<tr><td></td>\n";653 write_header_cell($class, "Server");654 write_header_cell($class, "Alive?");655 $link = "czartool_labels.php?pass=".$pass656 ."&proj=".$proj657 ."&label=".$selectedLabel658 ."&stage=".$selectedStage659 ."&plottype=".$plotType660 ."&allservercmd=stop";661 662 $link = ""; # TODO removed links temporarily663 write_table_cell($class, '%s', $link, "Stop all");664 $link = "czartool_labels.php?pass=".$pass665 ."&proj=".$proj666 ."&label=".$selectedLabel667 ."&stage=".$selectedStage668 ."&plottype=".$plotType669 ."&allservercmd=run";670 671 $link = ""; # TODO removed links temporarily672 write_table_cell($class, '%s', $link, "Run all");673 echo "</tr>\n";674 675 725 foreach ($servers as &$server) { 676 726 677 727 getServerStatus($db, $server, $alive, $running); 678 728 679 echo "<tr> <td></td>\n";729 echo "<tr>\n"; 680 730 $link = "czartool_labels.php?pass=".$pass 681 731 ."&proj=".$proj … … 686 736 687 737 #$link = ""; # TODO removed links temporarily 688 write_table_cell($class, '%s', $link, $server); 689 write_table_cell($class, '%s', "", $alive ? "yes" : "NO"); 690 691 if ($alive) { 692 693 $link = "czartool_labels.php?pass=".$pass 694 ."&proj=".$proj 695 ."&label=".$selectedLabel 696 ."&stage=".$selectedStage 697 ."&plottype=".$plotType 698 ."&server=".$server 699 ."&servercmd="; 700 701 if ($running) { 702 703 $link = $link . "stop"; 704 $link = ""; # TODO removed links temporarily 705 write_table_cell($class, '%s', $link, "stop"); 706 write_table_cell($class, '%s', "", ""); 707 } 708 else { 709 710 $link = $link . "run"; 711 write_table_cell($class, '%s', "", ""); 712 $link = ""; # TODO removed links temporarily 713 write_table_cell($class, '%s', $link, "run"); 714 } 715 } 716 else { 717 718 write_table_cell($class, '%s', "", ""); 719 write_table_cell($class, '%s', "", ""); 720 } 738 //write_table_cell($class, '%s', $link, $server); 739 //write_table_cell($class, '%s', "", $alive ? "yes" : "NO"); 740 //echo "<td>$server</td>"; 741 createFormattedTableCell(1, $link, $server, 0); 742 createFormattedTableCell(0, "", $alive ? "yes" : "NO", !$alive); 743 createFormattedTableCell(0, "", $running ? "yes" : "NO", !$running); 744 745 //if ($alive) { 746 747 // $link = "czartool_labels.php?pass=".$pass 748 // ."&proj=".$proj 749 // ."&label=".$selectedLabel 750 // ."&stage=".$selectedStage 751 // ."&plottype=".$plotType 752 // ."&server=".$server 753 // ."&servercmd="; 754 755 //if ($running) { 756 757 // $link = $link . "stop"; 758 // $link = ""; # TODO removed links temporarily 759 // write_table_cell($class, '%s', $link, "stop"); 760 // write_table_cell($class, '%s', "", ""); 761 // } 762 // else { 763 764 // $link = $link . "run"; 765 // write_table_cell($class, '%s', "", ""); 766 // $link = ""; # TODO removed links temporarily 767 // write_table_cell($class, '%s', $link, "run"); 768 // } 769 // } 770 // else { 771 772 // write_table_cell($class, '%s', "", ""); 773 // write_table_cell($class, '%s', "", ""); 774 // } 721 775 echo "</tr>\n"; 722 776 } … … 822 876 $dbRepl = DB::connect("mysql://$replUser:$replPassword@$replHost"); 823 877 if (PEAR::isError($dbRepl)) { 824 die("MySQL DB connection error: Check the configuration for $replDatabaseName"); 878 echo "<tr><td>$replDatabaseName</td><td bgcolor=\"red\">MySQL DB connection error - check configuration</td></tr>"; 879 //die("MySQL DB connection error: Check the configuration for $replDatabaseName"); 880 die(""); 881 return; 882 825 883 } 826 884 $res = $dbRepl->query('SHOW SLAVE STATUS');
Note:
See TracChangeset
for help on using the changeset viewer.
