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"; foreach ( $packages as $pkg ) { $sql .= " AND "; if ( isset($pkgmatch[$pkg]) ) { $sql .= "(NOT (".$pkgmatch[$pkg]."))"; } else { $sql .= "( script NOT LIKE '%".$pkg."%' AND software NOT LIKE '%".$pkg."%' )"; } } $sql .= " AND system LIKE '".$_POST['system']."' AND ( ".dateselect("submit",$_POST['start_date'],$_POST['end_date'])." ) GROUP BY system ORDER BY jobs DESC"; #echo "
".$sql."
\n"; $result = db_query($db,$sql); echo "\n"; echo "\n"; while ($result->fetchInto($row)) { echo ""; $rkeys=array_keys($row); foreach ($rkeys as $key) { $data=array(); $data[$key] = $row[$key]; echo ""; } echo "\n"; } echo "
systemjobsusersgroupsaccounts
".$data[$key]."
\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']).") AS cpuhours FROM Jobs WHERE ( "; $isfirst = 1; foreach ( $packages as $pkg ) { if ( $isfirst==1 ) { $isfirst = 0; } else { $sql .= " AND "; } if ( isset($pkgmatch[$pkg]) ) { $sql .= "NOT (".$pkgmatch[$pkg].")"; } else { $sql .= "( script NOT LIKE '%".$pkg."%' AND software NOT LIKE '%".$pkg."%' )"; } } $sql .= " ) AND system LIKE '".$_POST['system']."' AND ( ".dateselect("submit",$_POST['start_date'],$_POST['end_date'])." ) GROUP BY account, system ORDER BY cpuhours DESC"; #echo "
".$sql."
\n"; $result = db_query($db,$sql); echo "\n"; echo "\n"; while ($result->fetchInto($row)) { echo ""; $rkeys=array_keys($row); foreach ($rkeys as $key) { $data=array(); $data[$key] = $row[$key]; echo ""; } echo "\n"; } echo "
accountsystemusersjobscpuhours
".$data[$key]."
\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 ( "; $isfirst = 1; foreach ( $packages as $pkg ) { if ( $isfirst==1 ) { $isfirst = 0; } else { $sql .= " AND "; } if ( isset($pkgmatch[$pkg]) ) { $sql .= "NOT (".$pkgmatch[$pkg].")"; } else { $sql .= "( script NOT LIKE '%".$pkg."%' AND software NOT LIKE '%".$pkg."%' )"; } } $sql .= " ) AND system LIKE '".$_POST['system']."' AND ( ".dateselect("submit",$_POST['start_date'],$_POST['end_date'])." ) GROUP BY username, account, system ORDER BY jobs DESC"; #echo "
".$sql."
\n"; $result = db_query($db,$sql); echo "\n"; echo "\n"; while ($result->fetchInto($row)) { echo ""; $rkeys=array_keys($row); foreach ($rkeys as $key) { $data=array(); $data[$key] = $row[$key]; echo ""; } echo "\n"; } echo "
usergroupaccountsystemjobs
".$data[$key]."
\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 ( "; $isfirst = 1; foreach ( $packages as $pkg ) { if ( $isfirst==1 ) { $isfirst = 0; } else { $sql .= " AND "; } if ( isset($pkgmatch[$pkg]) ) { $sql .= "NOT (".$pkgmatch[$pkg].")"; } else { $sql .= "( script NOT LIKE '%".$pkg."%' AND software NOT LIKE '%".$pkg."%' )"; } } $sql .= " ) AND system LIKE '".$_POST['system']."' AND ( ".dateselect("submit",$_POST['start_date'],$_POST['end_date'])." ) ORDER BY start_ts;"; #echo "
".$sql."
\n"; $result = db_query($db,$sql); echo "\n"; $ncols=1; $col[0]="jobid"; echo ""; foreach ($keys as $key) { if ( $key!='start_date' && $key!='end_date' ) { echo ""; $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 "\n"; } else if ($col[$key] == "jobid") { $jobid_nodot = ereg_replace('\..*', '', $data[$key]); echo ""; } else { echo ""; } } echo "\n"; } echo "
jobid".$key."
".date("Y-m-d H:i:s",$data[$key])."
",
		  htmlspecialchars($jobid_nodot), "
".htmlspecialchars($data[$key])."
\n"; db_disconnect($db); 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","submithost","hostlist","exit_status","script"); checkboxes_from_array("Properties",$props); end_form(); } page_footer(); ?>