function get_bucketed_metric($db, $system, $xaxis, $metric, $start_date, $end_date) { $query = "SELECT " . xaxis_column($xaxis) . ",COUNT(jobid) AS jobcount"; if (columns($metric, $system) != "") { $query .= "," . columns($metric, $system); } if ($xaxis == "walltime" || $xaxis == "walltime_req") { $query .= ",MIN(TIME_TO_SEC(" . $xaxis . ")) AS hidden"; } elseif ($xaxis == "nproc_bucketed") { $query .= ",MIN(nproc) AS hidden"; } else { $query .= ",MIN(" . $xaxis . ") AS hidden"; } $query .= " FROM Jobs WHERE (" . sysselect($system) . ") AND (" . dateselect("start", $start_date, $end_date) . ")"; if (clause($xaxis, $metric) != "") { $query .= " AND " . clause($xaxis, $metric); } if ($xaxis == "nproc_bucketed") { $query .= " GROUP BY nproc"; } else { $query .= " GROUP BY " . $xaxis; } $query .= " ORDER BY hidden;"; #print "<PRE>".$query."</PRE>\n"; return db_query($db, $query); }
function sysselect($system) { if ($system == 'amd') { return "system = 'amd'"; } if ($system == 'apple') { return "system = 'apple'"; } if ($system == 'bale') { return "system = 'bale'"; } if ($system == 'coe') { return "system = 'coe'"; } if ($system == 'ipf') { return "system = 'ipf'"; } if ($system == 'ipf-altix') { return "system = 'ipf' AND hostlist REGEXP '^ipf50[1-3]'"; } if ($system == 'ipf-noaltix') { return "system = 'ipf' AND hostlist NOT REGEXP '^ipf50[1-3]'"; } if ($system == 'ipf-oldmyri') { return "system = 'ipf' AND hostlist REGEXP '^ipf(0[0-9][0-9]|1([0-1][0-9]|2[0-8]))'"; } if ($system == 'ipf-newmyri') { return "system = 'ipf' AND hostlist REGEXP '^ipf(1(49|[5-9][0-9])|2([0-4][0-9]|5[0-8]))'"; } if ($system == 'ipf-myri') { return "(" . sysselect('ipf-oldmyri') . ") OR (" . sysselect('ipf-newmyri') . ") "; } if ($system == 'ipf-bigmem') { return "system = 'ipf' AND hostlist REGEXP '^ipf1(29|3[0-9]|4[0-8])'"; } if ($system == 'ipf-serial') { return "system = 'ipf' AND ( queue = 'serial' OR queue = 'bigmem' OR queue = 'smallsmp' )"; } if ($system == 'ipf-parallel') { return "system = 'ipf' AND ( queue = 'parallel' OR queue = 'dedicated' OR queue = 'gige' )"; } if ($system == 'ipf-smp') { return "system = 'ipf' AND ( queue = 'hugemem' OR queue = 'smp' OR queue = 'dedicatedsmp' OR queue = 'sas' OR queue = 'starp' )"; } if ($system == 'ipf+mck') { return "( " . sysselect('mck') . " OR " . sysselect('ipf') . " )"; } if ($system == 'ipf+mck-altix') { return "(" . sysselect('mck-altix') . ") OR (" . sysselect('ipf-altix') . ") "; } if ($system == 'ipf+mck-noaltix') { return "( " . sysselect('mck-noaltix') . " ) OR ( " . sysselect('ipf-noaltix') . " )"; } if ($system == 'ipf+mck-oldmyri') { return "( " . sysselect('ipf-oldmyri') . " ) OR ( " . sysselect('mck-myri') . " ) "; } if ($system == 'ipf+mck-bigmem') { return "( " . sysselect('ipf-bigmem') . " ) OR ( " . sysselect('mck-bigmem') . " ) "; } if ($system == 'mck') { return "system = 'mck'"; } if ($system == 'mck-altix') { return "system = 'mck' AND hostlist REGEXP '^mck149'"; } if ($system == 'mck-noaltix') { return "system = 'mck' AND hostlist NOT REGEXP '^mck149'"; } if ($system == 'mck-myri') { return "system = 'mck' AND hostlist REGEXP '^mck(0[0-9][0-9]|1([0-1][0-9]|2[0-8]))'"; } if ($system == 'mck-bigmem') { return "system = 'mck' AND hostlist REGEXP '^mck1(29|3[0-9]|4[0-8])'"; } if ($system == 'opt') { return "system = 'opt'"; } if ($system == 'piv') { return "system = 'piv'"; } if ($system == 'piv-ib') { return "system = 'piv' AND hostlist REGEXP '^piv(0[0-9][0-9]|1(0[0-9]|1[0-2]))'"; } if ($system == 'piv-noib') { return "system = 'piv' AND hostlist NOT REGEXP '^piv(0[0-9][0-9]|1(0[0-9]|1[0-2]))'"; } if ($system == 'piv-serial') { return "system = 'piv' AND ( queue = 'serial' OR queue = 'mdce' OR queue = 'sas' )"; } if ($system == 'piv-parallel') { return "system = 'piv' AND ( queue = 'parallel' OR queue = 'dedicated' OR queue = 'gige' )"; } if ($system == 'x1') { return "system = 'x1'"; } return "system LIKE '" . $system . "'"; }