Changeset 41134
- Timestamp:
- Nov 20, 2019, 1:34:57 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/raw/czartool_labels.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/raw/czartool_labels.php
r41125 r41134 214 214 echo "<td style=height:200px;width:400px;text-align:top;\">"; 215 215 216 ///////////////////////////////////////// 217 // timer begin for status and links 218 ///////////////////////////////////////// 219 $time = microtime(); 220 $time = explode(' ', $time); 221 $time = $time[1] + $time[0]; 222 $start = $time; 216 #echo "<br>"; 223 217 224 218 // status table at top 225 219 $nsStatus = getNightlyScienceStatus($czardb, $proj); 226 220 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 227 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . 228 "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 229 221 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 230 222 echo "<br>"; 231 223 echo $table; 232 createTableTitle("Status and links", 2); 224 225 createTableTitle("Status and links", 3); 233 226 echo "<tr>\n"; 234 echo "<tr><td>Time of last update</td> 235 <td>$lastUpdateTime</td></tr>"; 236 echo "<tr><td>ippMonitor SVN version</td> 237 <td>"; include 'version.php'; echo "</td></tr>"; 238 echo "<tr><td>Current nightly science status</td> 239 <td>$nsStatus</td></tr>"; 240 echo "<tr><td>Postage stamp server status</td> 241 <td><a href=\"http://pstamp.ipp.ifa.hawaii.edu/status.php\" target=new><font color=\"blue\">here</font></a></td></tr>"; 242 echo "<tr><td>Documentation</td> 243 <td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\" target=new><font color=\"blue\">here</font></a></td></tr>"; 244 echo "<tr><td>Cluster load</td> 245 <td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&hc=6&c=IPP%2520Production\"> 246 <font color=\"blue\">here</font></a> 247 <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"> 248 <font color=\"blue\">cpu_report</font></a> 249 <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"> 250 <font color=\"blue\">mem_report</font></a></td></tr>"; 251 echo "<tr><td>IPP metrics</td> 252 <td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\"><font color=\"blue\" target=new>here</font></a></td></tr>"; 253 echo "<tr><td>Czar log pages</td> 254 <td><a href=\"https://confluence.ipp.ifa.hawaii.edu/pages/viewrecentblogposts.action?key=IPPCZAR\" target=new><font color=\"blue\">here</font></a></td></tr>"; 255 echo "<tr><td>Exposure summary</td> 256 <td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>"; 257 echo "<tr><td>Confluence</td> 258 <td><a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IPPCZAR/IPP-Czaring+Home\" target=new><font color=\"blue\">here</font></a></td></tr>"; 259 echo "<tr><td>JIRA</td> 260 <td><a href=\"https://jira.ipp.ifa.hawaii.edu/secure/Dashboard.jspa\" target=new><font color=\"blue\">here</font></a></td></tr>"; 261 echo "<tr><td>data store</td> 262 <td><a href=\"https://svn.ifa.hawaii.edu/\" target=new><font color=\"blue\">here</font></a></td></tr>"; 227 echo "<tr><td>Time of last update</td><td>$lastUpdateTime</td></tr>"; 228 echo "<tr><td>ippMonitor SVN version</td><td>"; include 'version.php'; echo "</td></tr>"; 229 echo "<tr><td>Current nightly science status</td><td>$nsStatus</td></tr>"; 230 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>"; 231 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>"; 232 echo "<tr><td>Cluster load</td><td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&hc=6&c=IPP%2520Production\"><font color=\"blue\">here</font></a> <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"><font color=\"blue\">cpu_report</font></a> <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"><font color=\"blue\">mem_report</font></a></td></tr>"; 233 echo "<tr><td>IPP metrics</td><td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\"><font color=\"blue\">here</font></a></td></tr>"; 234 echo "<tr><td>Czar log pages</td><td><a href=\"https://confluence.ipp.ifa.hawaii.edu/pages/viewrecentblogposts.action?key=IPPCZAR\"><font color=\"blue\">here</font></a></td></tr>"; 235 echo "<tr><td>Exposure summary</td><td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>"; 236 echo "<tr><td>Confluence</td><td><a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IPPCZAR/IPP-Czaring+Home\"><font color=\"blue\">here</font></a></td></tr>"; 237 echo "<tr><td>JIRA</td><td><a href=\"https://jira.ipp.ifa.hawaii.edu/secure/Dashboard.jspa\"><font color=\"blue\">here</font></a></td></tr>"; 263 238 264 239 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 265 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode . 266 "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 267 268 // timer finished 269 echo "<tr><th colspan=4>"; 270 $time = microtime(); 271 $time = explode(' ', $time); 272 $time = $time[1] + $time[0]; 273 $finish = $time; 274 $total_time = round(($finish - $start), 3); 275 echo "loading in $total_time seconds."; 276 echo "</th></tr>"; 277 echo "</table><br>"; 278 279 createLabelsTable($pass, $proj, $czardb, $selectedMode, $labels, 280 $distLabelsExist, $pubLabelsExist, $stages, "new", $selectedLabel, 281 $selectedStage, $plotType); 282 if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();} 283 284 # XXX EAM : 2017.09.17 : debugging slowness 285 # CCL : 2019.11.09 : debugging slowness 286 //createSummitDataTable($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one 287 createSummitDataTable2($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one 288 289 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 290 // this was the major slowness part due to large table in czardb 291 292 createChunkDataTable($projectdb); // this is another part for slowness during nightly processing 293 294 createDatesTable($czardb, $proj); 295 296 ///////////////////////////////////////// 297 // timer begin for Database status 298 ///////////////////////////////////////// 299 $time = microtime(); 300 $time = explode(' ', $time); 301 $time = $time[1] + $time[0]; 302 $start = $time; 303 304 // status table at top 305 echo $table; 306 echo "<tr>"; 307 createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2); 308 309 echo "<tr>"; 310 createTableColumnHeader("Database"); 311 createTableColumnHeader("Status (sec behind master)"); 312 showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1); 313 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 314 showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY); 315 316 echo "<tr>"; 317 showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS); 318 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 319 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY); 320 showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY); 321 322 // some mysql replication slaves to add when they are returned to service 323 // showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); 324 // showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP); 325 326 // timer finished 327 echo "<tr><th colspan=2>"; 328 $time = microtime(); 329 $time = explode(' ', $time); 330 $time = $time[1] + $time[0]; 331 $finish = $time; 332 $total_time = round(($finish - $start), 3); 333 echo "loading in $total_time seconds."; 334 echo "</th></tr>"; 335 echo "</table><br>"; 336 337 ///////////////////////////////////////// 338 // timer begin for critical machines 339 ///////////////////////////////////////// 340 $time = microtime(); 341 $time = explode(' ', $time); 342 $time = $time[1] + $time[0]; 343 $start = $time; 344 345 // status table at top 346 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>"; 347 echo $table; 348 echo "<tr>"; 349 createTableTitle("Critical machine status", 3); 350 351 echo "<tr>"; 352 createTableColumnHeader("Hostname"); 353 createTableColumnHeader("Status"); 354 createTableColumnHeader("Loading time"); 355 showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY); 356 showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY); 357 showPingStatus($HOST_APACHE1, $DBNAME_APACHE1); 358 showPingStatus($HOST_APACHE2, $DBNAME_APACHE2); 359 showPingStatus($HOST_APACHE3, $DBNAME_APACHE3); 360 showPingStatus($HOST_APACHE4, $DBNAME_APACHE4); 361 showPingStatus($HOST_APACHE5, $DBNAME_APACHE5); 362 showPingStatus($HOST_APACHE6, $DBNAME_APACHE6); 363 showPingStatus($HOST_APACHE7, $DBNAME_APACHE7); 364 showPingStatus($HOST_APACHE8, $DBNAME_APACHE8); 365 // echo "<td>ippc70 (apache node) <td> $PingStatus <td> 0 seconds "; // comment out if ippc70 is back 366 showPingStatus($HOST_PROXY, $DBNAME_PROXY); 367 showPingStatus($HOST_SVN, $DBNAME_SVN); 368 showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE); 369 370 // timer finished 371 echo "<tr><th colspan=3>"; 372 $time = microtime(); 373 $time = explode(' ', $time); 374 $time = $time[1] + $time[0]; 375 $finish = $time; 376 $total_time = round(($finish - $start), 3); 377 echo "loading in $total_time seconds."; 378 echo "</th></tr>"; 379 echo "</table><br>"; 380 381 240 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 241 242 echo "</table>\n"; 243 244 echo "<br>"; 245 246 createLabelsTable($pass, 247 $proj, 248 $czardb, 249 $selectedMode, 250 $labels, 251 $distLabelsExist, 252 $pubLabelsExist, 253 $stages, 254 "new", 255 $selectedLabel, 256 $selectedStage, 257 $plotType); 258 259 if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();} 260 echo "<br>"; 261 262 # XXX EAM : 2017.09.17 : debugging slowness 263 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); echo "<br>"; 264 createSummitDataTable($projectdb); echo "<br>"; // this is slow because of the join between summitExp and rawExp 265 createChunkDataTable($projectdb); echo "<br>"; 266 createDatesTable($czardb, $proj); echo "<br>"; 267 268 echo $table; 269 echo "<tr>"; 270 createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2); 271 272 echo "<tr>"; 273 createTableColumnHeader("Database"); 274 createTableColumnHeader("Status (sec behind master)"); 275 showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1); 276 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 277 showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY); 278 279 echo "<tr>"; 280 281 showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS); 282 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 283 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY); 284 showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY); 285 286 # some mysql replication slaves to add when they are returned to service 287 # showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); 288 # showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP); 289 echo "</table>"; 290 291 echo $table; 292 echo "<tr>"; 293 createTableTitle("Critical machine status", 2); 294 295 echo "<tr>"; 296 createTableColumnHeader("Hostname"); 297 createTableColumnHeader("Status"); 298 showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY); 299 showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY); 300 301 # showPingStatus($HOST_APACHE1, $DBNAME_APACHE1); 302 showPingStatus($HOST_APACHE2, $DBNAME_APACHE2); 303 showPingStatus($HOST_APACHE3, $DBNAME_APACHE3); 304 showPingStatus($HOST_APACHE4, $DBNAME_APACHE4); 305 showPingStatus($HOST_APACHE5, $DBNAME_APACHE5); 306 showPingStatus($HOST_APACHE6, $DBNAME_APACHE6); 307 showPingStatus($HOST_APACHE7, $DBNAME_APACHE7); 308 showPingStatus($HOST_PROXY, $DBNAME_PROXY); 309 showPingStatus($HOST_SVN, $DBNAME_SVN); 310 showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE); 311 312 echo "</table>"; 313 314 echo "</table>"; 382 315 menu_end(); 383 316 384 385 #############################################################################386 ############################# Functions Below #############################387 #############################################################################388 317 389 318 ########################################################################### … … 432 361 } 433 362 363 ########################################################################### 364 # 365 # Creates a table of summitExp against rawExp 366 # 367 ########################################################################### 368 function createSummitDataTable($projectdb) { 369 370 $date = date("Y-m-d"); 371 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 372 373 $qry = $projectdb->query($sql); 374 if (dberror($qry)) { 375 echo "<b>error reading newExp table</b><br>\n"; 376 echo "<br><small><b> table query : $sql </b></small><br>\n"; 377 menu_end(); 378 } 379 380 // set up the table 381 global $table; 382 echo $table; 383 echo "<tr>"; 384 createTableTitle("Status of last night's data", 4); 385 echo "<tr>"; 386 createTableColumnHeader("Exposure type"); 387 createTableColumnHeader("At summit"); 388 createTableColumnHeader("Registered at MHPCC"); 389 createTableColumnHeader("At summit (Dropped)"); 390 391 $msg = "No science images taken since $date"; 392 393 // list the results 394 while ($qry->fetchInto($expType)) { 395 396 $sql = "SELECT COUNT(*) FROM summitExp left join pzDownloadExp using (summit_id) WHERE dateobs > '$date' AND exp_type = '$expType[0]' and (state != 'drop' or state is null) and fault != 1042"; 397 # $sql = "SELECT COUNT(*) FROM summitExp WHERE dateobs > '$date' AND exp_type = '$expType[0]'"; 398 $qry2 = $projectdb->query($sql); 399 $qry2->fetchInto($summit); 400 401 402 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 403 $qry2 = $projectdb->query($sql); 404 $qry2->fetchInto($mhpcc); 405 406 $sql = "SELECT COUNT(*) FROM summitExp join pzDownloadExp using (summit_id) WHERE dateobs > '$date' AND exp_type = '$expType[0]' and state = 'drop'"; 407 $qry2 = $projectdb->query($sql); 408 $qry2->fetchInto($dropped); 409 410 411 #Query with 30 minutes delay to check during the night if any exposures are missing. 412 $datehour = gmdate("Y-m-d H:i:s"); 413 $sql = "SELECT COUNT(*) FROM summitExp left join pzDownloadExp using (summit_id) WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) AND exp_type = '$expType[0]' and (state != 'drop' or state is null) and fault != 1042"; 414 $qry2 = $projectdb->query($sql); 415 $qry2->fetchInto($summitdelay); 416 417 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 418 $qry2 = $projectdb->query($sql); 419 $qry2->fetchInto($mhpccdelay); 420 421 echo "<tr>"; 422 423 $DLdiff = $summit[0] - $mhpcc[0]; 424 if ($DLdiff == 0) $error = 0; 425 else $error = 1; 426 427 $delayDLdiff = $summitdelay[0] - $mhpccdelay[0]; 428 if ($delayDLdiff == 0) $errordelay = 0; 429 else $errordelay = 1; 430 431 echo "<td>$expType[0]</td>"; 432 echo "<td>$summit[0]</td>"; 433 #createFormattedTableCell("", "", $mhpcc[0], $error, 0); 434 if ($delayDLdiff==0) { 435 createFormattedTableCell("", "", $mhpcc[0], $error, 0); 436 } else { 437 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$mhpcc[0] ($delayDLdiff)</font>"; 438 echo "<td>$DLStatus</td>"; 439 } 440 441 echo "<td>$dropped[0]</td>"; 442 443 echo "</tr>"; 444 } 445 446 echo "</table>\n"; 447 448 } 434 449 435 450 ########################################################################### … … 440 455 function createChunkDataTable($projectdb) { 441 456 442 // timer start443 $time = microtime();444 $time = explode(' ', $time);445 $time = $time[1] + $time[0];446 $start = $time;447 448 // function begin449 457 #First find the reference exposure ID to speed up the subsequent queries 450 458 $date = gmdate("Y-m-d"); … … 460 468 } 461 469 462 #Find the number of chunks 463 $query = "SELECT groupchunk.chunk,groupchunk.Nquad_firstvisit,group4.Nquad_fourvisits FROM"; 464 $query .= " ("; 465 $query .= " SELECT dateobs,comment,substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nquad_firstvisit"; 466 $query .= " FROM rawExp"; 467 $query .= " WHERE dateobs LIKE '$date%' AND exp_id > $refExpID[0]"; 468 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING'"; 469 $query .= " AND comment LIKE '%visit 1%'"; 470 $query .= " GROUP BY chunk"; 471 $query .= " ) AS groupchunk"; 472 $query .= " LEFT JOIN"; 473 $query .= " ("; 474 $query .= " SELECT groupobj.chunk,count(*) AS Nquad_fourvisits FROM "; 475 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nvisits"; 476 $query .= " FROM rawExp"; 477 $query .= " WHERE dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 478 $query .= " AND obs_mode NOT LIKE 'ENGINEERING' AND comment LIKE '%visit%'"; 479 $query .= " GROUP BY object, filter, chunk"; 480 $query .= " ) AS groupobj"; 481 $query .= " WHERE groupobj.Nvisits = 4 "; 482 $query .= " GROUP BY groupobj.chunk"; 483 $query .= " ) AS group4"; 484 $query .= " on groupchunk.chunk=group4.chunk ORDER BY dateobs"; 485 486 #$sql = "SELECT DISTINCT substr(comment, 1, position(' ' in comment)) FROM rawExp WHERE dateobs LIKE '$date%' AND exp_id > $refExpID AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND comment LIKE '%visit 1%'"; 470 #do a query of raw/chip/cam/warp counts for this night, split by chunk. 471 #we need to do a subquery to find the total number of skycells in warpSkyfile, as well as the number of those with a bad quality 472 $query = "SELECT suba.chunk,suba.Nvis1,suba.Nvis2,suba.Nvis3,suba.Nvis4,suba.Ncamgood,suba.Ncambad,subb.Nwarpgood,subb.Nwarpbad FROM "; 473 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(if(rawExp.comment LIKE '%visit 1%',1,NULL)) AS Nvis1,"; 474 $query .= " count(if(rawExp.comment LIKE '%visit 2%',1,NULL)) AS Nvis2,count(if(rawExp.comment LIKE '%visit 3%',1,NULL)) AS Nvis3,"; 475 $query .= " count(if(rawExp.comment LIKE '%visit 4%',1,NULL)) AS Nvis4, count(if(camProcessedExp.sigma_ra <= 5 AND camProcessedExp.sigma_dec <= 5 AND camProcessedExp.quality = 0,1,NULL)) AS Ncamgood,"; 476 $query .= " count(if(camProcessedExp.sigma_ra > 5 OR camProcessedExp.sigma_dec > 5 OR camProcessedExp.quality > 0,1,NULL)) AS Ncambad"; 477 $query .= " FROM rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) JOIN camProcessedExp USING (cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id)"; 478 $query .= " WHERE dateobs like '$date%' AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'"; 479 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 480 $query .= " GROUP BY chunk ORDER BY dateobs) as suba "; 481 $query .= "LEFT JOIN"; 482 $query .= " (SELECT subc.chunk, count(if(subc.Nwarpskycellbad < subc.Nwarpskycell,1,NULL)) AS Nwarpgood, count(if(subc.Nwarpskycellbad = subc.Nwarpskycell,1,NULL)) AS Nwarpbad"; 483 $query .= " FROM "; 484 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(warpSkyfile.quality) AS Nwarpskycell,count(if(warpSkyfile.quality > 0,1,NULL)) AS Nwarpskycellbad"; 485 $query .= " FROM 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) JOIN warpSkyfile USING (warp_id)"; 486 $query .= " WHERE dateobs like '$date%' AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'"; 487 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 488 $query .= " GROUP BY exp_name) as subc"; 489 $query .= " GROUP BY chunk) AS subb "; 490 $query .= "ON suba.chunk=subb.chunk"; 487 491 488 492 $qry = $projectdb->query($query); 489 493 if (dberror($qry)) { 490 echo "<b>error reading rawExptable</b><br>\n";494 echo "<b>error querying SQL table</b><br>\n"; 491 495 echo "<br><small><b> table query : $query </b></small><br>\n"; 492 496 menu_end(); … … 497 501 echo $table; 498 502 echo "<tr>"; 499 createTableTitle("Status of last night's chunks", 5);503 createTableTitle("Status of last night's chunks", 10); 500 504 echo "<tr>"; 501 505 createTableColumnHeader("Chunk"); 502 createTableColumnHeader("Nobs_1stvisit"); 503 createTableColumnHeader("Nobs_4visits(bad cam)"); 504 createTableColumnHeader("Ndiffs_published"); 506 createTableColumnHeader("Nobs"); 507 createTableColumnHeader("Ncam"); 508 createTableColumnHeader("Nwrp"); 509 createTableColumnHeader("wrp_pub"); 510 createTableColumnHeader("Nwwd"); 511 createTableColumnHeader("wwd_pub"); 512 createTableColumnHeader("Nwsd"); 513 createTableColumnHeader("wsd_pub"); 505 514 createTableColumnHeader("Completion"); 506 515 … … 509 518 // list the results 510 519 while ($qry->fetchInto($row)) { 511 $Nfirstvisits = 0; 512 $Nfourvisits = 0; 513 $badcam = 0; 520 $Nvis1 = 0; 521 $Nvis2 = 0; 522 $Nvis3 = 0; 523 $Nvis4 = 0; 524 $Ncamgood = 0; 525 $Ncambad = 0; 526 $Nwarpgood = 0; 527 $Nwarpbad = 0; 528 $NexpWWdiff = 0; 529 $Npubwarps = 0; 514 530 515 531 $chunkname = $row[0]; 516 if($row[1] > 0) $Nfirstvisits = $row[1]; 517 if($row[2] > 0) $Nfourvisits = $row[2]; 518 519 $query2 = " SELECT warp_id FROM "; 520 $query2 .= " warpRun JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)"; 521 $query2 .= " WHERE rawExp.dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 522 $query2 .= " AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%'"; 532 if($row[1] > 0) $Nvis1 = $row[1]; 533 if($row[2] > 0) $Nvis2 = $row[2]; 534 if($row[3] > 0) $Nvis3 = $row[3]; 535 if($row[4] > 0) $Nvis4 = $row[4]; 536 if($row[5] > 0) $Ncamgood = $row[5]; 537 if($row[6] > 0) $Ncambad = $row[6]; 538 if($row[7] > 0) $Nwarpgood = $row[7]; 539 if($row[8] > 0) $Nwarpbad = $row[8]; 540 541 #set flags if present 542 if($Ncambad >= 1) $badcamflag = 1; 543 if($Nwarpbad >= 1) $badwarpflag = 1; 544 545 $query1 = "SELECT suba.chunk, SUM(IF(suba.Nvisits = 2,1,NULL)) as totvis2, SUM(IF(suba.Nvisits = 3 OR suba.Nvisits = 4,2,NULL)) as totvis34 FROM"; 546 $query1 .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nvisits FROM"; 547 $query1 .= " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) WHERE dateobs like '$date%'"; 548 $query1 .= " AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 549 $query1 .= " AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%' group by object) as suba group by chunk;"; 550 $qry1 = $projectdb->query($query1); 551 while ($qry1->fetchInto($row)) {$NexpWWdiff = $row[1] + $row[2];} 552 553 #find the unique diff_ids for each chunk, to be matched to the diffRun catalog 554 $query2 = " SELECT diff_id,warp1,stack1,warp2,stack2 FROM "; 555 $query2 .= " diffInputSkyfile JOIN warpRun ON (warp1=warp_id OR warp2=warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)"; 556 $query2 .= " WHERE rawExp.dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 557 $query2 .= " AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL' AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%' GROUP By diff_id"; 523 558 $qry2 = $projectdb->query($query2); 524 559 525 $Ndiffs = 0; 560 $NWWdiffgood = 0; 561 $NWWdiffbad = 0; 562 $NWWdiffpub = 0; 563 564 $NWSdiffgood = 0; 565 $NWSdiffbad = 0; 566 $NWSdiffpub = 0; 567 $wrpcnt = array(); 568 526 569 while ($qry2->fetchInto($row2)) { 527 $query3 = " SELECT diff_id FROM "; 528 $query3 .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp1=warp_id)"; 529 $query3 .= " WHERE stack2 IS NULL AND publishRun.state LIKE 'full' AND warp_id='$row2[0]' GROUP BY diff_id"; 530 $qry3 = $projectdb->query($query3); 531 while ($qry3->fetchInto($row3)) { 532 if ($row3[0] !=0) $Ndiffs ++; 533 } 534 535 $query3 = " SELECT diff_id FROM "; 536 $query3 .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp2=warp_id)"; 537 $query3 .= " WHERE stack2 IS NULL AND publishRun.state LIKE 'full' AND warp_id='$row2[0]' GROUP BY diff_id"; 538 $qry3 = $projectdb->query($query3); 539 while ($qry3->fetchInto($row3)) { 540 if ($row3[0] !=0) $Ndiffs ++; 541 } 570 #distinguish between WW and WS diffs based on stack2 571 if ($row2[4] == 0) { 572 #find the total number of skycell and the number of skycell with a bad quality flag as well as the full publish state 573 $query3 = " SELECT count(diffSkyfile.quality) AS Ndiff,count(if(diffSkyfile.quality > 0,1,NULL)) AS Ndiffbad,count(if(publishRun.state LIKE 'full',1,NULL)) AS Npub FROM "; 574 $query3 .= " diffRun JOIN diffSkyfile USING (diff_id) LEFT JOIN publishRun ON (diffRun.diff_id = stage_id)"; 575 $query3 .= " WHERE diff_id='$row2[0]' GROUP BY diffRun.diff_id"; 576 $qry3 = $projectdb->query($query3); 577 578 while ($qry3->fetchInto($row3)) { 579 #if all skycells have bad quality, this is a bad diff. If all the skycells are in a full state in publishRun, it is fully published 580 if ($row3[1]<$row3[0]) $NWWdiffgood ++; 581 if ($row3[1]==$row3[0]) $NWWdiffbad ++; 582 if ($row3[2]==$row3[0]) $NWWdiffpub ++; 583 584 #if this wwdiff is published, record its corresponding warp_ids to see how many unique ones there are 585 if ($row3[2]==$row3[0]) $wrpcnt{$row2[1]}++; # record the presence of warp1 586 if ($row3[2]==$row3[0]) $wrpcnt{$row2[3]}++; # record the presence of warp2 587 } 588 } 589 590 if ($row2[4] > 0) { 591 #find the total number of skycell and the number of skycell with a bad quality flag as well as the full publish state 592 $query3 = " SELECT count(diffSkyfile.quality) AS Ndiff,count(if(diffSkyfile.quality > 0,1,NULL)) AS Ndiffbad,count(if(publishRun.state LIKE 'full',1,NULL)) AS Npub FROM "; 593 $query3 .= " diffRun JOIN diffSkyfile USING (diff_id) LEFT JOIN publishRun ON (diffRun.diff_id = stage_id)"; 594 $query3 .= " WHERE diff_id='$row2[0]' GROUP BY diffRun.diff_id"; 595 $qry3 = $projectdb->query($query3); 596 597 while ($qry3->fetchInto($row3)) { 598 #if all skycells have bad quality, this is a bad diff. If all the skycells are in a full state in publishRun, it is fully published 599 if ($row3[1]<$row3[0]) $NWSdiffgood ++; 600 if ($row3[1]==$row3[0]) $NWSdiffbad ++; 601 if ($row3[2]==$row3[0]) $NWSdiffpub ++; 602 } 603 } 542 604 } 543 544 if ($Ndiffs != ($Nfirstvisits*4)) $complete = "chunk not done"; 545 if ($Ndiffs == ($Nfirstvisits*4)) $complete = "chunk done"; 546 547 if ($Nfirstvisits != $Nfourvisits) { 548 $Ndiffs .= "/? "; 605 #pull out the unique warp_ids 606 $Npubwarps = count($wrpcnt); 607 608 #check for bad diffs 609 if(($NWWdiffbad >= 1) or ($NWSdiffbad >= 1)) $baddiffflag = 1; 610 611 if ($Nvis1 != $Nvis4) { 612 if ($NWWdiffpub != $NexpWWdiff) $complete = "chunk incomplete, not done"; 613 if ($NWWdiffpub == $NexpWWdiff) $complete = "chunk incomplete, done"; 549 614 } 550 if ($Nfirstvisits == $Nfourvisits) { 551 $Ndiffs .= "/"; 552 $Ndiffs .= $Nfirstvisits*4; 615 if ($Nvis1 == $Nvis4) { 616 if ($NWWdiffpub != $NexpWWdiff) $complete = "chunk complete, not done"; 617 if ($NWWdiffpub == $NexpWWdiff) $complete = "chunk complete, done"; 618 553 619 } 554 620 555 #also query for bad quality camRun exposures556 $query4 = "SELECT count(*) ";557 $query4 .= " FROM rawExp";558 $query4 .= " JOIN chipRun USING (exp_id)";559 $query4 .= " JOIN camRun USING (chip_id)";560 $query4 .= " JOIN camProcessedExp USING (cam_id)";561 $query4 .= " WHERE dateobs LIKE '$date%'";562 $query4 .= " AND exp_id > $refExpID[0]";563 $query4 .= " AND exp_type = 'OBJECT'";564 $query4 .= " AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%'";565 $query4 .= " AND (camProcessedExp.quality > 0)";566 $qry4 = $projectdb->query($query4);567 $qry4->fetchInto($badcam);568 569 570 571 621 echo "<tr>"; 572 622 573 623 echo "<td>$chunkname</td>"; 574 echo "<td>$N firstvisits</td>";575 if ($badcam[0]==0) {576 echo "<td>$Nfourvisits</td>";577 } else {578 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$Nfourvisits ($badcam[0])</font>";579 echo "<td>$DLStatus</td>";580 }581 echo "<td>$N diffs</td>";624 echo "<td>$Nvis1/$Nvis2/$Nvis3/$Nvis4</td>"; 625 echo "<td>$Ncamgood/$Ncambad</td>"; 626 echo "<td>$Nwarpgood/$Nwarpbad</td>"; 627 echo "<td>$Npubwarps</td>"; 628 echo "<td>$NWWdiffgood/$NWWdiffbad</td>"; 629 echo "<td>$NWWdiffpub</td>"; 630 echo "<td>$NWSdiffgood/$NWSdiffbad</td>"; 631 echo "<td>$NWSdiffpub</td>"; 582 632 echo "<td>$complete</td>"; 583 633 584 634 echo "</tr>"; 585 635 } 586 587 588 // timer finished589 echo "<tr><th colspan=5>";590 $time = microtime();591 $time = explode(' ', $time);592 $time = $time[1] + $time[0];593 $finish = $time;594 $total_time = round(($finish - $start), 3);595 echo "loading in $total_time seconds.";596 $start= $finish;597 echo "</th></tr>";598 636 echo "</table></br>"; 599 637 … … 638 676 $selectedLabel, $selectedStage, $plotType) { 639 677 640 // timer start641 $time = microtime();642 $time = explode(' ', $time);643 $time = $time[1] + $time[0];644 $start = $time;645 646 // function begin647 678 $isUpdate = ($selectedMode == "update"); 648 679 global $headerColor; … … 768 799 769 800 echo "</tr>\n"; 770 771 // timer finished 772 echo "<tr><th colspan=11>"; 773 $time = microtime(); 774 $time = explode(' ', $time); 775 $time = $time[1] + $time[0]; 776 $finish = $time; 777 $total_time = round(($finish - $start), 3); 778 echo "loading in $total_time seconds."; 779 $start= $finish; 780 echo "</th></tr>"; 781 echo "</table><br>"; 801 echo "</table>\n"; 782 802 } 783 803 … … 927 947 function createDatesTable($db, $proj) { 928 948 929 // timer start930 $time = microtime();931 $time = explode(' ', $time);932 $time = $time[1] + $time[0];933 $start = $time;934 935 // function begin936 949 global $table; 937 950 echo $table; … … 946 959 createServerDateRow($db, $proj, "registration"); 947 960 948 // timer finished 949 echo "<tr><th colspan=11>"; 950 $time = microtime(); 951 $time = explode(' ', $time); 952 $time = $time[1] + $time[0]; 953 $finish = $time; 954 $total_time = round(($finish - $start), 3); 955 echo "loading in $total_time seconds."; 956 $start= $finish; 957 echo "</th></tr>"; 958 echo "</table><br>"; 959 961 echo "</table>\n"; 960 962 } 961 963 … … 999 1001 function createServersTable($pass, $proj, $selectedMode, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 1000 1002 1001 // timer start1002 $time = microtime();1003 $time = explode(' ', $time);1004 $time = $time[1] + $time[0];1005 $start = $time;1006 1007 // function begin1008 1003 // set up table columns 1009 1004 global $table; … … 1092 1087 } 1093 1088 1094 // timer finished 1095 echo "<tr><th colspan=5>"; 1096 $time = microtime(); 1097 $time = explode(' ', $time); 1098 $time = $time[1] + $time[0]; 1099 $finish = $time; 1100 $total_time = round(($finish - $start), 3); 1101 echo "loading in $total_time seconds."; 1102 $start= $finish; 1103 echo "</th></tr>"; 1104 echo "</table><br>\n"; 1089 echo "</table>\n"; 1105 1090 } 1106 1091 … … 1144 1129 function getServerStatus($db,$proj, $server, &$alive, &$running) { 1145 1130 1146 # $sql = "SELECT alive, running FROM science_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1147 $sql = "SELECT alive, running FROM live_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1131 $sql = "SELECT alive, running FROM science_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1148 1132 if($debug){echo "$sql<br>";} 1149 1133 … … 1264 1248 ########################################################################### 1265 1249 function showPingStatus($Host, $DatabaseName) { 1266 // timer start1267 $time = microtime();1268 $time = explode(' ', $time);1269 $time = $time[1] + $time[0];1270 $start = $time;1271 1272 // function begin1273 1250 exec("ping -c 1 $Host", $res, $rval); 1274 1251 if ($rval == 0){ … … 1277 1254 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>"; 1278 1255 } 1279 echo "<tr><td>$DatabaseName</td>"; 1280 1281 echo "</td><td>$PingStatus</td>"; 1282 // timer finished 1283 echo "<td>"; 1284 $time = microtime(); 1285 $time = explode(' ', $time); 1286 $time = $time[1] + $time[0]; 1287 $finish = $time; 1288 $total_time = round(($finish - $start), 3); 1289 echo "$total_time seconds"; 1290 $start= $finish; 1291 echo "</td></tr>"; 1292 } 1293 1294 1295 ########################################################################### 1296 # 1297 # Creates a table of summitExp against rawExp 1298 # 1299 ########################################################################### 1300 function createSummitDataTable($projectdb) { 1301 1302 // timer start 1303 $time = microtime(); 1304 $time = explode(' ', $time); 1305 $time = $time[1] + $time[0]; 1306 $start = $time; 1307 1308 // function begin 1309 $date = date("Y-m-d"); 1310 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 1311 1312 $qry = $projectdb->query($sql); 1313 if (dberror($qry)) { 1314 echo "<b>error reading newExp table</b><br>\n"; 1315 echo "<br><small><b> table query : $sql </b></small><br>\n"; 1316 menu_end(); 1317 } 1318 1319 // set up the table 1320 global $table; 1321 echo $table; 1322 echo "<tr>"; 1323 createTableTitle("Data status > $date", 4); 1324 echo "<tr>"; 1325 createTableColumnHeader("Exposure type"); 1326 createTableColumnHeader("At summit"); 1327 createTableColumnHeader("Registered at MHPCC"); 1328 createTableColumnHeader("Summit (Drop/Null)"); 1329 1330 $msg = "No science images taken since $date"; 1331 1332 // list the results 1333 while ($qry->fetchInto($expType)) { 1334 1335 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1336 WHERE dateobs > '$date' AND exp_type = '$expType[0]'"; 1337 // AND state != 'drop' AND state is not null AND fault != 1042"; 1338 $qry2 = $projectdb->query($sql); 1339 $qry2->fetchInto($summit); 1340 1341 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1342 WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 1343 $qry2 = $projectdb->query($sql); 1344 $qry2->fetchInto($mhpcc); 1345 1346 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1347 WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)"; 1348 $qry2 = $projectdb->query($sql); 1349 $qry2->fetchInto($dropped); 1350 1351 1352 #Query with 30 minutes delay to check during the night if any exposures are missing. 1353 $datehour = gmdate("Y-m-d H:i:s"); 1354 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1355 WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) 1356 AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042"; 1357 1358 $qry2 = $projectdb->query($sql); 1359 $qry2->fetchInto($summitdelay); 1360 1361 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1362 WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) 1363 AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 1364 $qry2 = $projectdb->query($sql); 1365 $qry2->fetchInto($mhpccdelay); 1366 1367 echo "<tr>"; 1368 1369 $DLdiff = $summit[0] - $mhpcc[0]; 1370 if ($DLdiff == 0) $error = 0; 1371 else $error = 1; 1372 1373 $delayDLdiff = $summitdelay[0] - $mhpccdelay[0]; 1374 if ($delayDLdiff == 0) $errordelay = 0; 1375 else $errordelay = 1; 1376 1377 echo "<td>$expType[0]</td>"; 1378 echo "<td>$summit[0]</td>"; 1379 if ($delayDLdiff==0) { 1380 createFormattedTableCell("", "", $mhpcc[0], $error, 0); 1381 } else { 1382 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$mhpcc[0] ($delayDLdiff)</font>"; 1383 echo "<td>$DLStatus</td>"; 1384 } 1385 1386 echo "<td>$dropped[0]</td>"; 1387 1388 echo "</tr>"; 1389 } 1390 1391 // timer finished 1392 echo "<tr><th colspan=4>"; 1393 $time = microtime(); 1394 $time = explode(' ', $time); 1395 $time = $time[1] + $time[0]; 1396 $finish = $time; 1397 $total_time = round(($finish - $start), 3); 1398 echo "loading in $total_time seconds."; 1399 $start= $finish; 1400 echo "</th></tr>"; 1401 echo "</table><br>"; 1402 } 1403 1404 1405 function createSummitDataTable2($projectdb) { 1406 1407 // timer start 1408 $time = microtime(); 1409 $time = explode(' ', $time); 1410 $time = $time[1] + $time[0]; 1411 $start = $time; 1412 1413 // function begin 1414 $date = date("Y-m-d"); 1415 // set up the table 1416 global $table; 1417 global $columnHeaderColor; 1418 echo $table; 1419 echo "<tr>"; 1420 createTableTitle("Data status > $date", 4); 1421 echo "<tr>"; 1422 createTableColumnHeader("Exp_type at summit"); 1423 createTableColumnHeader("Status at summit"); 1424 createTableColumnHeader("Status at mhpcc"); 1425 createTableColumnHeader("Number"); 1426 $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 1427 LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 1428 WHERE summitExp.dateobs > '$date' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state"; 1429 $qry = $projectdb->query($sql); 1430 while ($qry->fetchInto($tmp)) { 1431 if ($tmp[1] == NULL) { 1432 echo "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]"; 1433 } 1434 else { 1435 if ($tmp[1] == 'run') { 1436 echo "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]"; 1437 } 1438 else { 1439 if ($tmp[2] == NULL) { 1440 echo "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]"; 1441 } 1442 else { 1443 echo "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]"; 1444 } 1445 } 1446 } 1447 } 1448 1449 // timer finished 1450 echo "<tr><th colspan=4>"; 1451 $time = microtime(); 1452 $time = explode(' ', $time); 1453 $time = $time[1] + $time[0]; 1454 $finish = $time; 1455 $total_time = round(($finish - $start), 3); 1456 echo "loading in $total_time seconds."; 1457 $start= $finish; 1458 echo "</th></tr>"; 1459 echo "</table><br>"; 1460 } 1256 echo "<tr><td>$DatabaseName</td><td>$PingStatus</td></tr>"; 1257 } 1258 1461 1259 ?> 1462 1260
Note:
See TracChangeset
for help on using the changeset viewer.
