"; echo "Failed to connect to database server :("; exit(); } if( !mysql_select_db( "Stats", $conn ) ) { echo ""; echo "Failed to select database??"; exit(); } $q0 = "SELECT sjid, pjid, layoutid, inttime, UNIX_TIMESTAMP(NOW()) AS nu, UNIX_TIMESTAMP(timeofday) AS realstart, UNIX_TIMESTAMP(schedend) AS end, UNIX_TIMESTAMP(schedstart) AS start FROM SubJob ORDER BY timeofday DESC LIMIT 1"; $result = mysql_query( $q0, $conn ); if( !$result ) { echo ""; echo "Failed to query database (0):("; exit(); } $rij = mysql_fetch_array( $result, MYSQL_BOTH ); $sjid = $rij["sjid"]; $pjid = $rij["pjid"]; $layout = $rij["layoutid"]; $nu = $rij["nu"]; $reals = $rij["realstart"]; $schede = $rij["end"]; $scheds = $rij["start"]; $inttime= $rij["inttime"]; $q = "SELECT DATE_FORMAT(timeofday, '%d %M %Y/%T') AS Time, DATE_FORMAT(NOW(), '%d %M %Y/%T') AS TimeNow, firstdata AS FirstData, lastdata AS LastData, DATE_FORMAT(schedstart,'%T') AS FirstSched, DATE_FORMAT(schedend, '%T') AS LastSched, inttime AS IntTime FROM SubJob WHERE sjid=$sjid"; $result = mysql_query( $q, $conn ); if( !$result ) { echo ""; echo "Failed to query database (1):("; exit(); } if( !mysql_num_rows($result) ) { echo ""; echo "Bummer. No records found."; exit(); } $q2 = "SELECT su0, su1, su2, su3, su4, su5, su6, su7, su8, su9, su10, su11, su12, su13, su14, su15 FROM SULayout WHERE layoutid=$layout"; $result2 = mysql_query( $q2, $conn ); if( !$result2 ) { echo ""; echo "Failed to query database (2):("; exit(); } // find the experiment and the subjobextra stuff! $q3 = "select jobid, expid from ProcJob where pjid=$pjid"; $result3 = mysql_query( $q3, $conn ); if( !$result3 ) { echo ""; echo "Failed to query database (3):("; exit(); } $erij = mysql_fetch_array( $result3, MYSQL_BOTH ); $expid = $erij["expid"]; $jobid = $erij["jobid"]; $q4 = "select source, frequency from SubJobExtra where sjid=$sjid"; $result4 = mysql_query( $q4, $conn ); if( !$result4 ) { echo ""; echo "Failed to query database (4):("; exit(); } $erij = mysql_fetch_array( $result4, MYSQL_BOTH ); $source = "Unknown"; $freq = "Unknown"; if( isset($erij["source"]) ) { $source = $erij["source"]; } if( isset($erij["frequency"]) ) { $freq = $erij["frequency"]; } //The last/current job run(ning) on the EVN MkIV correlator $timerunning = true; $jobinfo = mysql_fetch_array( $result, MYSQL_BOTH ); $hasdata = isset( $jobinfo["FirstData"] ); $cooklstdata = 0; if( isset($CookieLastData) ) { $cooklstdata = $CookieLastData; } else { $cooklstdata = $jobinfo["LastData"]; setcookie("CookieLastData", $jobinfo["LastData"], 0, "/~verkout/correlator/", ".jive.nl", 0); } $cooklstupdt = 0; if( isset($CookieLastUpdate) ) { $cooklstupdt = $CookieLastUpdate; } else { // not set yet. set it $cooklstupdt = $nu; setcookie("CookieLastUpdate", $nu, 0, "/~verkout/correlator/", ".jive.nl", 0); } // only send a new cookie // if something changed! if( $jobinfo["LastData"]!=$cooklstdata ) { setcookie("CookieLastData", $jobinfo["LastData"], 0, "/~verkout/correlator/", ".jive.nl", 0); setcookie("CookieLastUpdate", $nu, 0, "/~verkout/correlator/", ".jive.nl", 0); } // iff (timediff/inttime)=nints > (refresh/inttime)=nintexpected // HV: 9/11/2004 - Gracefully handle $inttime==0 // (not set/unknown in DB) $timerunning = false; if( $inttime!=0 ) { // work out (depending on the integration time) // 1) how many integrations could have arrived // between "current time in the experiment" and // the "time of last update" // 2) how many integrations we expect in the // "refresh" period // and compare them. If the former is // less than or equal to the latter, // the experiment's time is running. // Otherwise, the experiment's 'clock' stopped // running some time ago in the future and is // not refreshed anymore (thus deltaT is growing // and hence 'nints' is getting larger and larger..) $nints = ($nu-$cooklstupdt)/$inttime; $expec = $refresh/$inttime; if( !($nints>($expec+1)) ) { $timerunning = true; } } // if( ($nu-$cooklstupdt)>=2*$inttime ) // { // $timerunning = false; // } $duration = $schede-$scheds; $running = ($nu <= ($reals+$duration)); ?> Current activity @the EVN MkIV Correlator "; if( $running && $timerunning ) { $status = "Running"; } else if( $running && !$timerunning ) { $status = "Aborted?!"; } else { $status = "finished"; } ?>
   

Experiment

Job

Status


 

job started at:

Source:

Observing freq:

MHz

Time of first data:

(schedule: )

last data:

(schedule: )

No data available yet
\n"; echo "\n"; $idcol = -1; $cnt = 0; while( $cnt".mysql_fieldname($result,$cnt)."\n"; $cnt++; } echo "\n"; $nf = mysql_num_fields($result); while( ($row=mysql_fetch_row($result)) ) { echo "\n"; $fcnt = 0; while( $fcnt<$nf ) { if( $fcnt!=$idcol ) { echo " ".$row[$fcnt]."\n"; } $fcnt++; continue; } echo "\n"; } echo "\n"; */ echo "
 \n"; echo "
\n"; echo "\n"; echo "\n"; $idcol = -1; $cnt = 0; while( $cnt".mysql_fieldname($result2,$cnt)."\n"; $cnt++; } echo "\n"; $nf = mysql_num_fields($result2); while( ($row=mysql_fetch_row($result2)) ) { echo "\n"; $fcnt = 0; while( $fcnt<$nf ) { if( $fcnt!=$idcol ) { echo " \n"; } $fcnt++; continue; } echo "\n"; } echo "
".$row[$fcnt]."
\n"; ?>