System Summary\n";
$sql = "SELECT system, COUNT(jobid) AS jobs, COUNT(DISTINCT(username)) AS users, COUNT(DISTINCT(groupname)) AS groups, COUNT(DISTINCT(account)) AS accounts FROM Jobs WHERE script IS NOT NULL AND sw_app is NULL 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);
if ( PEAR::isError($result) )
{
echo "".$result->getMessage()."
\n";
}
echo "\n";
echo "system | jobs | users | groups | accounts |
\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();
# account summary table
echo "Account Summary
\n";
$sql = "SELECT account, system, COUNT(DISTINCT(username)) AS users, COUNT(jobid) AS jobs, SUM(".cpuhours($db,$_POST['system'],$_POST['start_date'],$_POST['end_date'],$_POST['datelogic']).") AS cpuhours, SUM(".charges($db,$_POST['system'],$_POST['start_date'],$_POST['end_date'],$_POST['datelogic']).") AS charges FROM Jobs WHERE script IS NOT NULL AND sw_app IS NULL AND system LIKE '".$_POST['system']."' AND ( ".dateselect($_POST['datelogic'],$_POST['start_date'],$_POST['end_date'])." ) GROUP BY account, system ORDER BY cpuhours DESC";
#echo "".$sql."
\n";
$result = db_query($db,$sql);
if ( PEAR::isError($result) )
{
echo "".$result->getMessage()."
\n";
}
echo "\n";
echo "account | system | users | jobs | cpuhours | charges |
\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();
# user summary table
echo "User Summary
\n";
$sql = "SELECT DISTINCT(username) AS username, groupname, account, system, COUNT(jobid) AS jobs FROM Jobs WHERE script IS NOT NULL AND sw_app IS NULL AND system LIKE '".$_POST['system']."' AND ( ".dateselect($_POST['datelogic'],$_POST['start_date'],$_POST['end_date'])." ) GROUP BY username, account, system ORDER BY jobs DESC";
#echo "".$sql."
\n";
$result = db_query($db,$sql);
if ( PEAR::isError($result) )
{
echo "".$result->getMessage()."
\n";
}
echo "\n";
echo "user | group | account | 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 ( ";
$sql .= "script IS NOT NULL AND sw_app IS NULL";
$sql .= " ) 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";
page_timer();
bookmarkable_url();
}
else
{
begin_form("unmatched-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","energy","software","submithost","hostlist",
"exit_status","script");
checkboxes_from_array("Properties",$props);
end_form();
}
db_disconnect($db);
page_footer();
?>