System Summary\n";
$sql = "SELECT system, COUNT(jobid) AS jobs, COUNT(DISTINCT(username)) AS users, COUNT(DISTINCT(groupname)) AS groups FROM Jobs WHERE ( script IS NOT NULL AND ( script NOT LIKE '%TMPDIR%' AND script NOT LIKE '%/tmp%' AND script NOT LIKE '%PFSDIR%' ) AND walltime_req > '1:00:00' ) AND system LIKE '".$_POST['system']."' AND ( ".dateselect($_POST['datelogic'],$_POST['start_date'],$_POST['end_date'])." ) GROUP BY system ORDER BY jobs DESC";
#echo "
".$sql."
\n";
$result = db_query($db,$sql);
echo "\n";
echo "system | jobs | users | groups |
\n";
while ($result->fetchInto($row))
{
echo "";
$rkeys=array_keys($row);
foreach ($rkeys as $key)
{
$data=array();
$data[$key] = $row[$key];
echo "".$data[$key]." | ";
}
echo "
\n";
}
if ( $_POST['system']=="%" )
{
$sql = "SELECT 'TOTAL', COUNT(jobid), COUNT(DISTINCT(username)), COUNT(DISTINCT(groupname)) FROM Jobs WHERE ( script IS NOT NULL AND ( script NOT LIKE '%TMPDIR%' AND script NOT LIKE '%/tmp%' AND script NOT LIKE '%PFSDIR%' ) AND walltime_req > '1:00:00' ) AND ( ".dateselect($_POST['datelogic'],$_POST['start_date'],$_POST['end_date'])." )";
$result = db_query($db,$sql);
while ($result->fetchInto($row))
{
echo "";
$rkeys=array_keys($row);
foreach ($rkeys as $key)
{
$data=array();
$data[$key] = $row[$key];
echo "".$data[$key]." | ";
}
echo "
\n";
}
}
echo "
\n";
ob_flush();
flush();
# user summary table
echo "User Summary
\n";
$sql = "SELECT DISTINCT(username) AS username, groupname, system, COUNT(jobid) AS jobs FROM Jobs WHERE ( script IS NOT NULL AND ( script NOT LIKE '%TMPDIR%' AND script NOT LIKE '%/tmp%' AND script NOT LIKE '%PFSDIR%' ) AND walltime_req > '1:00:00' ) AND system LIKE '".$_POST['system']."' AND ( ".dateselect($_POST['datelogic'],$_POST['start_date'],$_POST['end_date'])." ) GROUP BY username, system ORDER BY jobs DESC";
#echo "".$sql."
\n";
$result = db_query($db,$sql);
echo "\n";
echo "user | group | system | jobs |
\n";
while ($result->fetchInto($row))
{
echo "";
$rkeys=array_keys($row);
foreach ($rkeys as $key)
{
$data=array();
$data[$key] = $row[$key];
echo "".$data[$key]." | ";
}
echo "
\n";
}
echo "
\n";
ob_flush();
flush();
# job info
echo "Jobs
\n";
$sql = "SELECT jobid";
foreach ($keys as $key)
{
if ( isset($_POST[$key]) && $key!='jobid' && $key!='start_date' && $key!='end_date' )
{
$sql .= ",".$key;
}
}
$sql .= " FROM Jobs WHERE ( script IS NOT NULL AND ( script NOT LIKE '%TMPDIR%' AND script NOT LIKE '%/tmp%' AND script NOT LIKE '%PFSDIR%' ) AND walltime_req > '1:00:00' ) AND system LIKE '".$_POST['system']."' AND ( ".dateselect($_POST['datelogic'],$_POST['start_date'],$_POST['end_date'])." ) ORDER BY start_ts;";
# echo "".$sql."
\n";
$result = db_query($db,$sql);
if ( PEAR::isError($result) )
{
echo "".$result->getMessage()."
\n";
}
echo "\n";
$ncols=1;
$col[0]="jobid";
echo "jobid | ";
foreach ($keys as $key)
{
if ( $key!='start_date' && $key!='end_date' )
{
echo "".$key." | ";
$col[$ncols]=$key;
$ncols++;
}
}
echo "
\n";
while ($result->fetchInto($row))
{
echo "";
$rkeys=array_keys($row);
foreach ($rkeys as $key)
{
$data[$key]=array_shift($row);
if ( $col[$key]=="submit_ts" || $col[$key]=="start_ts" || $col[$key]=="end_ts")
{
echo "".date("Y-m-d H:i:s",$data[$key])." | \n";
}
else if ($col[$key] == "jobid")
{
$jobid_nodot = ereg_replace('\..*', '', $data[$key]);
echo "",
htmlspecialchars($jobid_nodot), " | ";
}
else
{
echo "".htmlspecialchars($data[$key])." | ";
}
}
echo "
\n";
}
echo "
\n";
db_disconnect($db);
page_timer();
bookmarkable_url();
}
else
{
begin_form("problem-jobs.php");
system_chooser();
date_fields();
$props=array("username","groupname","account","jobname","nproc","mppe","mppssp",
"nodes","feature","gres","queue","qos","submit_ts","start_ts","end_ts","cput_req",
"cput","walltime_req","walltime","mem_req","mem_kb",
"vmem_req","vmem_kb","submithost","hostlist","exit_status","script");
checkboxes_from_array("Properties",$props);
end_form();
}
page_footer();
?>