Changeset 41003
- Timestamp:
- Oct 30, 2019, 1:51:16 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ccl_branches/ipp-20190806/ippMonitor/raw/czartool_labels.php
r40974 r41003 8 8 if (! $ID['proj']) { projectform ($ID); } 9 9 10 // connect to czarDb 11 $czardb = dbconnect($CZARDBNAME); 10 // connect to czarDb 11 $czardb = dbconnect($CZARDBNAME); 12 12 $lastUpdateTime = getLastUpdateTime($czardb); 13 13 … … 35 35 "fullforce", 36 36 "diff", 37 "dist", 37 "dist", 38 38 "pub", 39 39 ); … … 49 49 "fullforce" => "failedFullForceSkyfiles.php", 50 50 "diff" => "failedDiffSkyfile.php", 51 "dist" => "NONE", 51 "dist" => "NONE", 52 52 "pub" => "publishDone.php", 53 ); 53 ); 54 54 55 55 $mainTable = array( … … 62 62 "fullforce" => "fullForceRun", 63 63 "diff" => "diffRun", 64 "dist" => "distRun", 64 "dist" => "distRun", 65 65 "pub" => "publishRun", 66 ); 66 ); 67 67 68 68 $addSearchState = array( … … 77 77 "dist" => 0, 78 78 "pub" => 0, 79 ); 79 ); 80 80 81 81 $servers=array( … … 100 100 101 101 // The Update mode of czartool is obsolete since we don't use the update 102 // pantasks. 102 // pantasks. 103 103 // $selectedMode = $_GET[mode]; 104 104 $selectedMode = "stdscience"; … … 226 226 echo "<tr>\n"; 227 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>"; 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 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 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>"; … … 244 244 echo "<br>"; 245 245 246 createLabelsTable($pass, 247 $proj, 248 $czardb, 249 $selectedMode, 250 $labels, 251 $distLabelsExist, 252 $pubLabelsExist, 253 $stages, 254 "new", 255 $selectedLabel, 256 $selectedStage, 246 createLabelsTable($pass, 247 $proj, 248 $czardb, 249 $selectedMode, 250 $labels, 251 $distLabelsExist, 252 $pubLabelsExist, 253 $stages, 254 "new", 255 $selectedLabel, 256 $selectedStage, 257 257 $plotType); 258 258 … … 263 263 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); echo "<br>"; 264 264 createSummitDataTable($projectdb); echo "<br>"; // this is slow because of the join between summitExp and rawExp 265 createChunkDataTable($projectdb); echo "<br>"; 265 createChunkDataTable($projectdb); echo "<br>"; 266 266 createDatesTable($czardb, $proj); echo "<br>"; 267 267 … … 353 353 echo "<td>$row[1]</td>"; 354 354 echo "<td>$row[2]</td>"; 355 355 356 356 echo "</tr>"; 357 357 } … … 399 399 $qry2->fetchInto($summit); 400 400 401 402 401 $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 402 $qry2 = $projectdb->query($sql); … … 408 407 $qry2->fetchInto($dropped); 409 408 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 409 echo "<tr>"; 422 410 423 $DLdiff = $summit[0] - $mhpcc[0]; 424 if ($DLdiff == 0) $error = 0; 411 if ($summit[0] == $mhpcc[0]) $error = 0; 425 412 else $error = 1; 426 427 $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];428 if ($delayDLdiff == 0) $errordelay = 0;429 else $errordelay = 1;430 413 431 414 echo "<td>$expType[0]</td>"; 432 415 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 416 createFormattedTableCell("", "", $mhpcc[0], $error, 0); 441 417 echo "<td>$dropped[0]</td>"; 442 418 … … 461 437 if (dberror($qry)) { 462 438 print "*** WARNING: no data in period 10-20 days before requested date (query will be slower) **\n"; 463 $refExpID = 0; 439 $refExpID = 0; 464 440 } 465 441 $qry->fetchInto($refExpID); … … 467 443 $refExpID[0] = 0; 468 444 } 445 469 446 470 447 #Find the number of chunks … … 509 486 createTableColumnHeader("Chunk"); 510 487 createTableColumnHeader("Nobs_1stvisit"); 511 createTableColumnHeader("Nobs_4visits (bad cam)");488 createTableColumnHeader("Nobs_4visits"); 512 489 createTableColumnHeader("Ndiffs_published"); 513 490 createTableColumnHeader("Completion"); … … 519 496 $Nfirstvisits = 0; 520 497 $Nfourvisits = 0; 521 $badcam = 0;522 498 523 499 $chunkname = $row[0]; … … 550 526 } 551 527 552 if ($Ndiffs != ($Nfirstvisits*4)) $complete = "chunk not done"; 553 if ($Ndiffs == ($Nfirstvisits*4)) $complete = "chunk done"; 528 if ($Ndiffs != ($Nfirstvisits*4)) $complete = "chunk not done"; 529 if ($Ndiffs == ($Nfirstvisits*4)) $complete = "chunk done"; 554 530 555 531 if ($Nfirstvisits != $Nfourvisits) { … … 561 537 } 562 538 563 #also query for bad quality camRun exposures564 $query4 = "SELECT count(*) ";565 $query4 .= " FROM rawExp";566 $query4 .= " JOIN chipRun USING (exp_id)";567 $query4 .= " JOIN camRun USING (chip_id)";568 $query4 .= " JOIN camProcessedExp USING (cam_id)";569 $query4 .= " WHERE dateobs LIKE '$date%'";570 $query4 .= " AND exp_id > $refExpID[0]";571 $query4 .= " AND exp_type = 'OBJECT'";572 $query4 .= " AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%'";573 $query4 .= " AND (camProcessedExp.quality > 0)";574 $qry4 = $projectdb->query($query4);575 $qry4->fetchInto($badcam);576 577 578 579 539 echo "<tr>"; 580 540 581 541 echo "<td>$chunkname</td>"; 582 542 echo "<td>$Nfirstvisits</td>"; 583 if ($badcam[0]==0) { 584 echo "<td>$Nfourvisits</td>"; 585 } else { 586 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$Nfourvisits ($badcam[0])</font>"; 587 echo "<td>$DLStatus</td>"; 588 } 543 echo "<td>$Nfourvisits</td>"; 589 544 echo "<td>$Ndiffs</td>"; 590 545 echo "<td>$complete</td>"; … … 623 578 ########################################################################### 624 579 function createLabelsTable( 625 $pass, 626 $proj, 627 $db, 628 $selectedMode, 629 $labels, 630 $distLabelsExist, 631 $pubLabelsExist, 632 $stages, 633 $selectedState, 580 $pass, 581 $proj, 582 $db, 583 $selectedMode, 584 $labels, 585 $distLabelsExist, 586 $pubLabelsExist, 587 $stages, 588 $selectedState, 634 589 $selectedLabel, $selectedStage, $plotType) { 635 590 … … 660 615 if ($stage == $selectedStage) $showLink = 0; 661 616 else $showLink = 1; 662 $link = 617 $link = 663 618 "czartool_labels.php?pass=".$pass 664 ."&proj=".$proj 619 ."&proj=".$proj 665 620 ."&mode=" .$selectedMode 666 621 ."&label=".$selectedLabel … … 673 628 674 629 // setup default link 675 $defaultlink = 630 $defaultlink = 676 631 "czartool_labels.php?pass=".$pass 677 632 ."&proj=".$proj … … 696 651 if ($thisLabel == $selectedLabel) $showLink = 0; 697 652 else $showLink = 1; 698 $link = 653 $link = 699 654 "czartool_labels.php?pass=".$pass 700 655 ."&proj=".$proj … … 706 661 707 662 $str = ""; 708 $anyFaults = false; 663 $anyFaults = false; 709 664 710 665 foreach ($stages as &$stage) { … … 727 682 728 683 $cellcolor = 0; 729 if ("$stage" == "dist") { 684 if ("$stage" == "dist") { 730 685 $cellcolor = (!$isUpdate && !$distributing) ? "gray" : 0; 731 686 } … … 802 757 ########################################################################### 803 758 # 804 # Sets reverts status 759 # Sets reverts status 805 760 # 806 761 ########################################################################### … … 816 771 ########################################################################### 817 772 # 818 # Returns current nightly science status 773 # Returns current nightly science status 819 774 # 820 775 ########################################################################### … … 900 855 ########################################################################### 901 856 # 902 # Populates a tables with the current dates listed in the server_dates table 857 # Populates a tables with the current dates listed in the server_dates table 903 858 # 904 859 ########################################################################### … … 923 878 ########################################################################### 924 879 # 925 # Checks the status of all the pantasks servers 880 # Checks the status of all the pantasks servers 926 881 # 927 882 ########################################################################### … … 933 888 $qry = $db->query($sql); 934 889 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 935 $dates = ""; 890 $dates = ""; 936 891 $firstIn = true; 937 892 while ($qry->fetchInto($row)) { … … 954 909 ########################################################################### 955 910 # 956 # Checks the status of all the pantasks servers 911 # Checks the status of all the pantasks servers 957 912 # 958 913 ########################################################################### … … 1050 1005 ########################################################################### 1051 1006 # 1052 # Commands a server to stop or run 1007 # Commands a server to stop or run 1053 1008 # 1054 1009 ########################################################################### … … 1059 1014 $running = 0; 1060 1015 if ($response[0] == "running") {$alive = 1; $running = 1;} 1061 else if ($response[0] == "stopped") {$alive = 1; $running = 0;} 1016 else if ($response[0] == "stopped") {$alive = 1; $running = 0;} 1062 1017 else if ($response[0] == "dead") {$alive = 0; $running = 0;} 1063 1018 setServerStatus($db, $server, $alive, $running); … … 1066 1021 ########################################################################### 1067 1022 # 1068 # Sets server status 1023 # Sets server status 1069 1024 # 1070 1025 ########################################################################### … … 1100 1055 ########################################################################### 1101 1056 # 1102 # Returns time of last czarDb update 1057 # Returns time of last czarDb update 1103 1058 # 1104 1059 ########################################################################### … … 1118 1073 ########################################################################### 1119 1074 # 1120 # Shows the status of the provided pantasks server 1075 # Shows the status of the provided pantasks server 1121 1076 # 1122 1077 ########################################################################### … … 1152 1107 } 1153 1108 1154 # note: mysql user must have either SUPER or REPLICATION CLIENT privileges on the database 1109 # note: mysql user must have either SUPER or REPLICATION CLIENT privileges on the database 1155 1110 $res = $dbRepl->query('SHOW SLAVE STATUS'); 1156 1111 if (dberror($res)) { … … 1168 1123 $sec_behind = 99999999; 1169 1124 $errorStatusInMySql = 999999999; 1170 } 1125 } 1171 1126 $replStatus = ($errorStatusInMySql==0?"OK ($sec_behind)":"<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">PROBLEM</font>"); 1172 1127 echo "<tr><td>$replDatabaseName</td><td>$replStatus</td></tr>";
Note:
See TracChangeset
for help on using the changeset viewer.
