IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41003


Ignore:
Timestamp:
Oct 30, 2019, 1:51:16 PM (7 years ago)
Author:
cclin33
Message:

updated from ippitc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ccl_branches/ipp-20190806/ippMonitor/raw/czartool_labels.php

    r40974 r41003  
    88if (! $ID['proj']) { projectform ($ID); }
    99
    10 // connect to czarDb 
    11 $czardb = dbconnect($CZARDBNAME); 
     10// connect to czarDb
     11$czardb = dbconnect($CZARDBNAME);
    1212$lastUpdateTime = getLastUpdateTime($czardb);
    1313
     
    3535        "fullforce",
    3636        "diff",
    37         "dist", 
     37        "dist",
    3838        "pub",
    3939        );
     
    4949        "fullforce" => "failedFullForceSkyfiles.php",
    5050        "diff"      => "failedDiffSkyfile.php",
    51         "dist"      => "NONE", 
     51        "dist"      => "NONE",
    5252        "pub"       => "publishDone.php",
    53 );           
     53);
    5454
    5555$mainTable = array(
     
    6262        "fullforce" => "fullForceRun",
    6363        "diff"      => "diffRun",
    64         "dist"      => "distRun", 
     64        "dist"      => "distRun",
    6565        "pub"       => "publishRun",
    66 );           
     66);
    6767
    6868$addSearchState = array(
     
    7777        "dist"      => 0,
    7878        "pub"       => 0,
    79 );           
     79);
    8080
    8181$servers=array(
     
    100100
    101101// The Update mode of czartool is obsolete since we don't use the update
    102 // pantasks. 
     102// pantasks.
    103103// $selectedMode = $_GET[mode];
    104104$selectedMode = "stdscience";
     
    226226echo "<tr>\n";
    227227echo "<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>"; 
     228echo "<tr><td>ippMonitor SVN version</td><td>"; include 'version.php'; echo "</td></tr>";
     229echo "<tr><td>Current nightly science status</td><td>$nsStatus</td></tr>";
    230230echo "<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>";
    231231echo "<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>";
     
    244244echo "<br>";
    245245
    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,
    257257         $plotType);
    258258
     
    263263      createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); echo "<br>";
    264264      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>";
    266266      createDatesTable($czardb, $proj); echo "<br>";
    267267
     
    353353        echo "<td>$row[1]</td>";
    354354        echo "<td>$row[2]</td>";
    355        
     355
    356356        echo "</tr>";
    357357    }
     
    399399        $qry2->fetchInto($summit);
    400400
    401 
    402401        $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]'";
    403402        $qry2 = $projectdb->query($sql);
     
    408407        $qry2->fetchInto($dropped);
    409408
    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 
    421409        echo "<tr>";
    422410
    423         $DLdiff = $summit[0] - $mhpcc[0];
    424         if ($DLdiff == 0) $error = 0;
     411        if ($summit[0] == $mhpcc[0]) $error = 0;
    425412        else $error = 1;
    426 
    427         $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];
    428         if ($delayDLdiff == 0) $errordelay = 0;
    429         else $errordelay = 1;
    430413
    431414        echo "<td>$expType[0]</td>";
    432415        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);
    441417        echo "<td>$dropped[0]</td>";
    442418
     
    461437    if (dberror($qry)) {
    462438        print "*** WARNING: no data in period 10-20 days before requested date (query will be slower) **\n";
    463         $refExpID = 0; 
     439        $refExpID = 0;
    464440    }
    465441    $qry->fetchInto($refExpID);
     
    467443        $refExpID[0] = 0;
    468444    }
     445
    469446
    470447    #Find the number of chunks
     
    509486    createTableColumnHeader("Chunk");
    510487    createTableColumnHeader("Nobs_1stvisit");
    511     createTableColumnHeader("Nobs_4visits(bad cam)");
     488    createTableColumnHeader("Nobs_4visits");
    512489    createTableColumnHeader("Ndiffs_published");
    513490    createTableColumnHeader("Completion");
     
    519496        $Nfirstvisits = 0;
    520497        $Nfourvisits = 0;
    521         $badcam = 0;
    522498
    523499        $chunkname = $row[0];
     
    550526        }
    551527
    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";
    554530
    555531        if ($Nfirstvisits != $Nfourvisits) {
     
    561537        }
    562538
    563         #also query for bad quality camRun exposures
    564         $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 
    579539        echo "<tr>";
    580540
    581541        echo "<td>$chunkname</td>";
    582542        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>";
    589544        echo "<td>$Ndiffs</td>";
    590545        echo "<td>$complete</td>";
     
    623578###########################################################################
    624579function 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,
    634589        $selectedLabel, $selectedStage, $plotType) {
    635590
     
    660615        if ($stage == $selectedStage) $showLink = 0;
    661616        else $showLink = 1;
    662         $link = 
     617        $link =
    663618            "czartool_labels.php?pass=".$pass
    664             ."&proj=".$proj 
     619            ."&proj=".$proj
    665620            ."&mode=" .$selectedMode
    666621            ."&label=".$selectedLabel
     
    673628
    674629    // setup default link
    675     $defaultlink = 
     630    $defaultlink =
    676631        "czartool_labels.php?pass=".$pass
    677632        ."&proj=".$proj
     
    696651        if ($thisLabel == $selectedLabel) $showLink = 0;
    697652        else $showLink = 1;
    698         $link = 
     653        $link =
    699654            "czartool_labels.php?pass=".$pass
    700655            ."&proj=".$proj
     
    706661
    707662        $str = "";
    708         $anyFaults = false; 
     663        $anyFaults = false;
    709664
    710665        foreach ($stages as &$stage) {
     
    727682
    728683          $cellcolor = 0;
    729           if ("$stage" == "dist") { 
     684          if ("$stage" == "dist") {
    730685            $cellcolor = (!$isUpdate && !$distributing) ? "gray" : 0;
    731686          }
     
    802757###########################################################################
    803758#
    804 # Sets reverts status 
     759# Sets reverts status
    805760#
    806761###########################################################################
     
    816771###########################################################################
    817772#
    818 # Returns current nightly science status 
     773# Returns current nightly science status
    819774#
    820775###########################################################################
     
    900855###########################################################################
    901856#
    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
    903858#
    904859###########################################################################
     
    923878###########################################################################
    924879#
    925 # Checks the status of all the pantasks servers 
     880# Checks the status of all the pantasks servers
    926881#
    927882###########################################################################
     
    933888    $qry = $db->query($sql);
    934889    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
    935     $dates = ""; 
     890    $dates = "";
    936891    $firstIn = true;
    937892    while ($qry->fetchInto($row)) {
     
    954909###########################################################################
    955910#
    956 # Checks the status of all the pantasks servers 
     911# Checks the status of all the pantasks servers
    957912#
    958913###########################################################################
     
    10501005###########################################################################
    10511006#
    1052 #  Commands a server to stop or run 
     1007#  Commands a server to stop or run
    10531008#
    10541009###########################################################################
     
    10591014    $running = 0;
    10601015    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;}
    10621017    else if ($response[0] == "dead") {$alive = 0; $running = 0;}
    10631018    setServerStatus($db, $server, $alive, $running);
     
    10661021###########################################################################
    10671022#
    1068 # Sets server status 
     1023# Sets server status
    10691024#
    10701025###########################################################################
     
    11001055###########################################################################
    11011056#
    1102 # Returns time of last czarDb update 
     1057# Returns time of last czarDb update
    11031058#
    11041059###########################################################################
     
    11181073###########################################################################
    11191074#
    1120 # Shows the status of the provided pantasks server 
     1075# Shows the status of the provided pantasks server
    11211076#
    11221077###########################################################################
     
    11521107    }
    11531108
    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
    11551110    $res = $dbRepl->query('SHOW SLAVE STATUS');
    11561111    if (dberror($res)) {
     
    11681123            $sec_behind = 99999999;
    11691124            $errorStatusInMySql = 999999999;
    1170         }   
     1125        }
    11711126        $replStatus = ($errorStatusInMySql==0?"OK ($sec_behind)":"<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">PROBLEM</font>");
    11721127        echo "<tr><td>$replDatabaseName</td><td>$replStatus</td></tr>";
Note: See TracChangeset for help on using the changeset viewer.