IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 4, 2019, 11:29:03 AM (7 years ago)
Author:
ippitc
Message:

CCL: update data status session

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/raw/czartool_labels.php

    r41178 r41192  
    236236echo "<tr><td>ippMonitor SVN version</td>
    237237          <td>"; include 'version.php'; echo "</td></tr>";
     238echo "<tr><td>Current PHP version: </td>
     239          <td>" . phpversion(); echo "</td></tr>";
    238240echo "<tr><td>Current nightly science status</td>
    239241          <td>$nsStatus</td></tr>";
     
    15561558#
    15571559###########################################################################
    1558 function createSummitDataTable($projectdb) {
     1560function createSummitDataTable2($projectdb) {
    15591561
    15601562    // timer start
     
    15651567
    15661568    // function begin
    1567     $date = date("Y-m-d");
    1568     $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";
    1569 
    1570     $qry = $projectdb->query($sql);
    1571     if (dberror($qry)) {
    1572         echo "<b>error reading newExp table</b><br>\n";
    1573         echo "<br><small><b> table query : $sql </b></small><br>\n";
    1574         menu_end();
    1575     }
    1576 
    1577     // set up the table
    1578     global $table;
    1579     echo $table;
    1580     echo "<tr>";
    1581     createTableTitle("Data status > $date", 4);
    1582     echo "<tr>";
    1583     createTableColumnHeader("Exposure type");
    1584     createTableColumnHeader("At summit");
    1585     createTableColumnHeader("Registered at MHPCC");
    1586     createTableColumnHeader("Summit (Drop/Null)");
    1587 
    1588     $msg = "No science images taken since $date";
    1589 
    1590     // list the results
    1591     while ($qry->fetchInto($expType)) {
    1592 
    1593         $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
    1594                 WHERE dateobs > '$date' AND exp_type = '$expType[0]'";
    1595              //   AND state != 'drop' AND state is not null AND fault != 1042";
    1596         $qry2 = $projectdb->query($sql);
    1597         $qry2->fetchInto($summit);
    1598 
    1599         $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name
    1600                 WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
    1601         $qry2 = $projectdb->query($sql);
    1602         $qry2->fetchInto($mhpcc);
    1603 
    1604         $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
    1605                 WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)";
    1606         $qry2 = $projectdb->query($sql);
    1607         $qry2->fetchInto($dropped);
    1608 
    1609 
    1610         #Query with 30 minutes delay to check during the night if any exposures are missing.
    1611         $datehour = gmdate("Y-m-d H:i:s");
    1612         $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
    1613                 WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute)
    1614                 AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042";
    1615 
    1616         $qry2 = $projectdb->query($sql);
    1617         $qry2->fetchInto($summitdelay);
    1618 
    1619         $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name
    1620                 WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute)
    1621                 AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
    1622         $qry2 = $projectdb->query($sql);
    1623         $qry2->fetchInto($mhpccdelay);
    1624 
    1625         echo "<tr>";
    1626 
    1627         $DLdiff = $summit[0] - $mhpcc[0];
    1628         if ($DLdiff == 0) $error = 0;
    1629         else $error = 1;
    1630 
    1631         $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];
    1632         if ($delayDLdiff == 0) $errordelay = 0;
    1633         else $errordelay = 1;
    1634 
    1635         echo "<td>$expType[0]</td>";
    1636         echo "<td>$summit[0]</td>";
    1637         if ($delayDLdiff==0) {
    1638            createFormattedTableCell("", "", $mhpcc[0], $error, 0);
    1639         } else {
    1640            $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">$mhpcc[0] ($delayDLdiff)</font>";
    1641            echo "<td>$DLStatus</td>";
    1642         }
    1643 
    1644         echo "<td>$dropped[0]</td>";
    1645 
    1646         echo "</tr>";
    1647     }
    1648 
    1649     // timer finished
    1650     echo "<tr><th colspan=4>";
    1651     $time = microtime();
    1652     $time = explode(' ', $time);
    1653     $time = $time[1] + $time[0];
    1654     $finish = $time;
    1655     $total_time = round(($finish - $start), 3);
    1656     echo "loading in $total_time seconds.";
    1657     $start= $finish;
    1658     echo "</th></tr>";
    1659     echo "</table><br>";
    1660 }
    1661 
    1662 
    1663 function createSummitDataTable2($projectdb) {
    1664 
    1665     // timer start
    1666     $time = microtime();
    1667     $time = explode(' ', $time);
    1668     $time = $time[1] + $time[0];
    1669     $start = $time;
    1670 
    1671     // function begin
    1672     $date = date("Y-m-d");
     1569    $date = gmdate("Y-m-d");
     1570    $datem1 = gmdate("Y-m-d",strtotime ( "-1 day") );
     1571    $datetime = gmdate("H:i:s");
     1572
    16731573    // set up the table
    16741574    global $table;
     
    16761576    echo $table;
    16771577    echo "<tr>";
    1678     createTableTitle("Data status > $date", 4);
     1578    createTableTitle("Data status tonight $date (UT) <br> current time $datetime", 4);
    16791579    echo "<tr>";
    16801580    createTableColumnHeader("Exp_type at summit");
     
    16841584    $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp
    16851585            LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name
    1686             WHERE summitExp.dateobs > '$date' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state";
     1586            WHERE summitExp.dateobs like '$date%' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state";
    16871587    $qry = $projectdb->query($sql);
    16881588    while ($qry->fetchInto($tmp)) {
     
    17051605    }
    17061606
     1607    echo "<tr><th colspan=4>Last night $datem1 (UT)";
     1608    $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp
     1609            LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name
     1610            WHERE summitExp.dateobs like '$datem1%' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state";
     1611    $qry = $projectdb->query($sql);
     1612    while ($qry->fetchInto($tmp)) {
     1613        if ($tmp[1] == NULL) {
     1614          echo  "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]";
     1615        }
     1616        else {
     1617          if ($tmp[1] == 'run') {
     1618            echo  "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]";
     1619          }
     1620          else {
     1621            if ($tmp[2] == NULL) {
     1622              echo  "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]";
     1623            }
     1624            else {
     1625              echo  "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]";
     1626            }
     1627          }
     1628        }
     1629    }
    17071630    // timer finished
    17081631    echo "<tr><th colspan=4>";
     
    17171640    echo "</table><br>";
    17181641}
     1642////////////////////////////////////////////////////////////////////////////////
     1643///                         no needed functions                              ///
     1644////////////////////////////////////////////////////////////////////////////////
     1645//function createSummitDataTable($projectdb) {
     1646//
     1647//    // timer start
     1648//    $time = microtime();
     1649//    $time = explode(' ', $time);
     1650//    $time = $time[1] + $time[0];
     1651//    $start = $time;
     1652//
     1653//    // function begin
     1654//    $date = date("Y-m-d");
     1655//    $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";
     1656//
     1657//    $qry = $projectdb->query($sql);
     1658//    if (dberror($qry)) {
     1659//        echo "<b>error reading newExp table</b><br>\n";
     1660//        echo "<br><small><b> table query : $sql </b></small><br>\n";
     1661//        menu_end();
     1662//    }
     1663//
     1664//    // set up the table
     1665//    global $table;
     1666//    echo $table;
     1667//    echo "<tr>";
     1668//    createTableTitle("Data status > $date", 4);
     1669//    echo "<tr>";
     1670//    createTableColumnHeader("Exposure type");
     1671//    createTableColumnHeader("At summit");
     1672//    createTableColumnHeader("Registered at MHPCC");
     1673//    createTableColumnHeader("Summit (Drop/Null)");
     1674//
     1675//    $msg = "No science images taken since $date";
     1676//
     1677//    // list the results
     1678//    while ($qry->fetchInto($expType)) {
     1679//
     1680//        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
     1681//                WHERE dateobs > '$date' AND exp_type = '$expType[0]'";
     1682//             //   AND state != 'drop' AND state is not null AND fault != 1042";
     1683//        $qry2 = $projectdb->query($sql);
     1684//        $qry2->fetchInto($summit);
     1685//
     1686//        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name
     1687//                WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
     1688//        $qry2 = $projectdb->query($sql);
     1689//        $qry2->fetchInto($mhpcc);
     1690//
     1691//        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
     1692//                WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)";
     1693//        $qry2 = $projectdb->query($sql);
     1694//        $qry2->fetchInto($dropped);
     1695//
     1696//
     1697//        #Query with 30 minutes delay to check during the night if any exposures are missing.
     1698//        $datehour = gmdate("Y-m-d H:i:s");
     1699//        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
     1700//                WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute)
     1701//                AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042";
     1702//
     1703//        $qry2 = $projectdb->query($sql);
     1704//        $qry2->fetchInto($summitdelay);
     1705//
     1706//        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name
     1707//                WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute)
     1708//                AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
     1709//        $qry2 = $projectdb->query($sql);
     1710//        $qry2->fetchInto($mhpccdelay);
     1711//
     1712//        echo "<tr>";
     1713//
     1714//        $DLdiff = $summit[0] - $mhpcc[0];
     1715//        if ($DLdiff == 0) $error = 0;
     1716//        else $error = 1;
     1717//
     1718//        $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];
     1719//        if ($delayDLdiff == 0) $errordelay = 0;
     1720//        else $errordelay = 1;
     1721//
     1722//        echo "<td>$expType[0]</td>";
     1723//        echo "<td>$summit[0]</td>";
     1724//        if ($delayDLdiff==0) {
     1725//           createFormattedTableCell("", "", $mhpcc[0], $error, 0);
     1726//        } else {
     1727//           $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">$mhpcc[0] ($delayDLdiff)</font>";
     1728//           echo "<td>$DLStatus</td>";
     1729//        }
     1730//
     1731//        echo "<td>$dropped[0]</td>";
     1732//
     1733//        echo "</tr>";
     1734//    }
     1735//
     1736//    // timer finished
     1737//    echo "<tr><th colspan=4>";
     1738//    $time = microtime();
     1739//    $time = explode(' ', $time);
     1740//    $time = $time[1] + $time[0];
     1741//    $finish = $time;
     1742//    $total_time = round(($finish - $start), 3);
     1743//    echo "loading in $total_time seconds.";
     1744//    $start= $finish;
     1745//    echo "</th></tr>";
     1746//    echo "</table><br>";
     1747//}
     1748
    17191749?>
    17201750
Note: See TracChangeset for help on using the changeset viewer.