IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 19, 2010, 6:50:13 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/ippMonitor/raw/czartool_labels.php

    r28794 r28980  
    1010//$db = dbconnect($ID['proj']);
    1111$czardb = dbconnect("czardb"); // HACK to connect to czarDb
     12$lastUpdateTime = getLastUpdateTime($czardb);
     13
    1214$gpc1db = dbconnect($ID['proj']);
    1315
     
    2224else {$myMenu = "ipp.imfiles.dat";}
    2325
    24 menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
     26menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']);
    2527
    2628$pass = $ID['pass'];
     
    3133$selectedLabel = $_GET[label];
    3234$selectedServer = $_GET[server];
    33 $selectedRevertServer = $_GET[revertserver];
    3435$selectedRevertStage = $_GET[revertstage];
    3536$selectedRevertMode = $_GET[revertmode];
    3637
    37 if ($selectedLabel == "") $selectedLabel = "all_labels";
    38 if ($selectedStage == "") $selectedStage = "all_stages";
     38if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; }
     39if ($selectedStage == "") { $selectedStage = "all_stages"; }
     40
     41echo 'Some documentation can be found <a href="http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing">here</a><br>';
    3942
    4043// deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later
    41 $currentRevertMode;
    42 if ($selectedRevertStage != "" && $selectedRevertMode != "" && $selectedRevertServer != "" ) {
    43 
    44     exec("czartool_revert.pl -s $selectedRevertServer -t $selectedRevertStage -o $selectedRevertMode", $response, $status);
     44if ($selectedRevertStage != "" && $selectedRevertMode != "") {
     45
     46    exec("czartool_revert.pl -t $selectedRevertStage -o $selectedRevertMode", $response, $status);
     47    $currentRevertMode;
    4548    if ($response[0] == "off") $currentRevertMode = 0;
    4649    else if ($response[0] == "on") $currentRevertMode = 1;
     50
     51    setRevertStatus($czardb, $selectedRevertStage, $currentRevertMode);
    4752}
    4853$debug = 0;
     
    5156$distLabels = getLabels($czardb, "distribution");
    5257$pubLabels = getLabels($czardb, "publishing");
     58$updateLabels = getLabels($czardb, "update");
    5359
    5460if ($debug) {
     
    8187echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
    8288echo "</form>\n";
    83 $lastUpdateTime = getLastUpdateTime($czardb);
    8489echo "<p  align=\"center\"> Current status of IPP (any faults are shown in parentheses). NOTE: This data is good as of: $lastUpdateTime </p>";
    8590
    8691echo "<table>\n";
    8792  echo "<tr>\n";
     93    echo "<td>\n";
     94      echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage\"><br>";
     95    echo "</td>\n";
    8896
    8997    echo "<td> \n";
    90       echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage\"><br>\n";
    91     echo "</td>\n";
    92 
    93     echo "<td> \n";
    94       createLabelsTable($pass, $proj, $czardb, $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage, $selectedRevertStage, $currentRevertMode);
    95     echo "</td>\n";
    96 
    97   echo "</tr>\n";
    98   echo "<tr>\n";
    99 
    100 echo "<table>\n";
    101   echo "<tr valign=top>\n";
    102     echo "<td> \n";
    103       echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage\"><br>\n";
    104     echo "</td>\n";
    105     echo "<td> \n";
    106       createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage);
    107     echo "</td>\n";
    108 
    109     echo "<td> \n";
    110       $today = date("Y-m-d");                         // 03.10.01
    111       showSummitData($gpc1db, $today);
     98      createLabelsTable($pass, $proj, $czardb, "stdscience", $stdsLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage);
    11299    echo "</td>\n";
    113100  echo "</tr>\n";
    114 echo "</table>\n";
    115 if ($selectedServer) showServerStatus($selectedServer);
    116 
     101
     102  echo "<tr>\n";
     103    echo "<td>\n";
     104      echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage\"><br>";
     105    echo "</td>\n";
     106
     107    echo "<td> \n";
     108      createLabelsTable($pass, $proj, $czardb, "update", $updateLabels, $distLabels, $pubLabels, $stages, $states, "new", $selectedLabel, $selectedStage);
     109    echo "</td>\n";
     110  echo "</tr>\n";
     111
     112  echo "<tr>\n";
     113    echo "<table>\n";
     114      echo "<tr valign=top>\n";
     115        echo "<td> \n";
     116          echo "<img src=\"czartool_getplot.php?type=s\"><br>";
     117        echo "</td>\n";
     118        echo "<td>\n";
     119          createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage);
     120        echo "</td>\n";
     121
     122        echo "<td> \n";
     123          $today = date("Y-m-d");
     124          showSummitData($gpc1db, $today);
     125        echo "</td>\n";
     126      echo "</tr>\n";
     127    echo "</table>\n";
     128
     129    echo "<table>\n";
     130      echo "<tr valign=top>\n";
     131        echo "<td> \n";
     132        echo "</td>\n";
     133        echo "<td>\n";
     134      if ($selectedServer) showServerStatus($selectedServer);
     135        echo "</td>\n";
     136      echo "</tr>\n";
     137    echo "</table>\n";
    117138  echo "</tr>\n";
    118139echo "</table>\n";
     
    203224#
    204225###########################################################################
    205 function createLabelsTable($pass, $proj, $db, $stdsLabels, $distLabels, $pubLabels, $stages, $states, $selectedState, $selectedLabel, $selectedStage, $selectedRevertStage, $currentRevertMode) {
     226function createLabelsTable($pass, $proj, $db, $server, $labels, $distLabels, $pubLabels, $stages, $states, $selectedState, $selectedLabel, $selectedStage) {
    206227
    207228    // set up table columns
     
    210231    echo "<tr><td></td>\n";
    211232
     233    echo "<p  align=\"center\"> Current labels for $server server </p>";
     234
    212235    write_header_cell($class, "");
    213236    write_header_cell($class, "");
     
    215238    foreach ($stages as &$stage) {
    216239
    217         $revertOnOff=array();
    218         if ($stage == "destreak" or $stage == "dist") $server = "distribution";
    219         else $server = "stdscience";
    220         if ($stage == $selectedRevertStage) $reverting = $currentRevertMode;
    221         else $reverting = getRevertStatus($db, $stage);
    222         $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&revertserver=" . $server . "&revertstage=" . $stage . "&revertmode=";
     240        $reverting = getRevertStatus($db, $stage);
     241        $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&revertmode=";
    223242        if(!$reverting) {$label =  "Start";$link = $link . "on";}
    224243        if($reverting) {$label = "Stop";$link = $link . "off";}
     
    250269
    251270    // write rows
    252     foreach ($stdsLabels as &$stdsLabel) {
     271    foreach ($labels as &$thisLabel) {
    253272
    254273        $distributing = false;
     
    256275        foreach ($distLabels as &$distLabel) {
    257276
    258             if ($stdsLabel == $distLabel) { $distributing = true; break;}
     277            if ($thisLabel == $distLabel) { $distributing = true; break;}
    259278        }
    260279        foreach ($pubLabels as &$pubLabel) {
    261280
    262             if ($stdsLabel == $pubLabel) { $publishing = true; break;}
     281            if ($thisLabel == $pubLabel) { $publishing = true; break;}
    263282        }
    264283
    265284        // create link to label summary page for each label
    266         if ($stdsLabel == $selectedLabel) $link = "";
    267         else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel . "&stage=" . $selectedStage;
     285        if ($thisLabel == $selectedLabel) $link = "";
     286        else $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $thisLabel . "&stage=" . $selectedStage;
    268287
    269288        echo "<tr><td></td>\n";
    270         write_table_cell($class, '%s', $link, $stdsLabel);
     289        write_table_cell($class, '%s', $link, $thisLabel);
    271290        write_table_cell($class, '%s', "", $distributing ? "yes" : "NO");
    272291        write_table_cell($class, '%s', "", $publishing ? "yes" : "NO");
     
    275294        $anyFaults = false;
    276295
    277         $link = "chipProcessedImfile_failure.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $stdsLabel . "&chipRun.state=new";
    278         getStateAndFaults($db, $stdsLabel, $selectedState, "chip", $str, $anyFaults);
     296        $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state=new";
     297        getStateAndFaults($db, $thisLabel, $selectedState, "chip", $str, $anyFaults);
    279298        write_table_cell($class, '%s', $anyFaults ? $link : "", $str);
    280299
    281         $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $stdsLabel . "&camRun.state=new";
    282         getStateAndFaults($db, $stdsLabel, $selectedState, "cam", $str, $anyFaults);
     300        $link = "failedCamProcessedExp.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $thisLabel . "&camRun.state=new";
     301        getStateAndFaults($db, $thisLabel, $selectedState, "cam", $str, $anyFaults);
    283302        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    284303
     304        $link =  "failedFakeProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&fakeRun.label=" . $thisLabel . "&fakeRun.state=new";
     305        getStateAndFaults($db, $thisLabel, $selectedState, "fake", $str, $anyFaults);
     306        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
     307
     308        $link = "failedWarpSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $thisLabel . "&warpRun.state=new";
     309        getStateAndFaults($db, $thisLabel, $selectedState, "warp", $str, $anyFaults);
     310        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
     311
     312        $link = "failedStackSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $thisLabel . "&stackRun.state=new";
     313        getStateAndFaults($db, $thisLabel, $selectedState, "stack", $str, $anyFaults);
     314        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
     315
     316        $link = "failedDiffSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $thisLabel . "&diffRun.state=new";
     317        getStateAndFaults($db, $thisLabel, $selectedState, "diff", $str, $anyFaults);
     318        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
     319
    285320        $link = $defaultlink;
    286         getStateAndFaults($db, $stdsLabel, $selectedState, "fake", $str, $anyFaults);
     321        getStateAndFaults($db, $thisLabel, $selectedState, "magic", $str, $anyFaults);
    287322        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    288323
    289         $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $stdsLabel . "&warpRun.state=new";
    290         getStateAndFaults($db, $stdsLabel, $selectedState, "warp", $str, $anyFaults);
    291         write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
    292 
    293         $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $stdsLabel . "&stackRun.state=new";
    294         getStateAndFaults($db, $stdsLabel, $selectedState, "stack", $str, $anyFaults);
     324        $link = $defaultlink;
     325        getStateAndFaults($db, $thisLabel, $selectedState, "magicDS", $str, $anyFaults);
    295326        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    296327
    297         $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $stdsLabel . "&diffRun.state=new";
    298         getStateAndFaults($db, $stdsLabel, $selectedState, "diff", $str, $anyFaults);
    299         write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
    300 
    301328        $link = $defaultlink;
    302         getStateAndFaults($db, $stdsLabel, $selectedState, "magic", $str, $anyFaults);
     329        getStateAndFaults($db, $thisLabel, $selectedState, "dist", $str, $anyFaults);
    303330        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    304331
    305         $link = $defaultlink;
    306         getStateAndFaults($db, $stdsLabel, $selectedState, "magicDS", $str, $anyFaults);
    307         write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    308 
    309         $link = $defaultlink;
    310         getStateAndFaults($db, $stdsLabel, $selectedState, "dist", $str, $anyFaults);
    311         write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    312 
    313332        echo "</tr>\n";
    314333    }
    315334
    316     if ($selectedLabel == "all_labels") $link = "";
    317     else  $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_labels&stage=".$selectedStage;
     335    if ($selectedLabel == "all_".$server."_labels") $link = "";
     336    else  $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage;
    318337
    319338    echo "<tr><td></td>\n";
    320     write_table_cell($class, '%s', $link, "All labels:");
    321     write_table_cell($class, '%s', "", "-");
    322     write_table_cell($class, '%s', "", "-");
    323 
    324     $str = "";
    325     $anyFaults = false;
    326 
    327     $link = "chipProcessedImfile_failure.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.state=new";
    328     getStateAndFaults($db, "all_labels", $selectedState, "chip", $str, $anyFaults);
    329     write_table_cell($class, '%s', $anyFaults ? $link : "", $str);
    330 
    331     $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&camRun.state=new";
    332     getStateAndFaults($db, "all_labels", $selectedState, "cam", $str, $anyFaults);
    333     write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    334 
    335     $link = $defaultlink;
    336     getStateAndFaults($db, "all_labels", $selectedState, "fake", $str, $anyFaults);
    337     write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    338 
    339     $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.state=new";
    340     getStateAndFaults($db, "all_labels", $selectedState, "warp", $str, $anyFaults);
    341     write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
    342 
    343     $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.state=new";
    344     getStateAndFaults($db, "all_labels", $selectedState, "stack", $str, $anyFaults);
    345     write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    346 
    347     $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.state=new";
    348     getStateAndFaults($db, "all_labels", $selectedState, "diff", $str, $anyFaults);
    349     write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
    350 
    351     $link = $defaultlink;
    352     getStateAndFaults($db, "all_labels", $selectedState, "magic", $str, $anyFaults);
    353     write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    354 
    355     $link = $defaultlink;
    356     getStateAndFaults($db, "all_labels", $selectedState, "magicDS", $str, $anyFaults);
    357     write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    358 
    359     $link = $defaultlink;
    360     getStateAndFaults($db, "all_labels", $selectedState, "dist", $str, $anyFaults);
    361     write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
    362 
     339    write_table_cell($class, '%s', $link, "All $server labels");
    363340
    364341    echo "</tr>\n";
     
    368345###########################################################################
    369346#
     347# Sets reverts status
     348#
     349###########################################################################
     350function setRevertStatus($db, $stage, $reverting) {
     351
     352    $sql = "UPDATE reverts SET reverting = $reverting WHERE stage LIKE '$stage'";
     353    if ($debug) {echo "$sql<br>";}
     354
     355    $qry = $db->query($sql);
     356    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     357}
     358
     359###########################################################################
     360#
    370361# Returns whether this stage is reverting or not
    371362#
     
    374365
    375366    $anyFaults = false;
    376     $sql = "SELECT reverting FROM $stage ORDER BY timestamp DESC LIMIT 1";
     367
     368    $sql = "SELECT reverting FROM reverts WHERE stage LIKE '$stage'";
    377369    if ($debug) {echo "$sql<br>";}
    378370
Note: See TracChangeset for help on using the changeset viewer.