Skip to content

Commit

Permalink
Merge pull request #335 from thanickcruz/xdmod10.5
Browse files Browse the repository at this point in the history
Modify SUPReMM Dataflow REST Endpoint
  • Loading branch information
jpwhite4 authored Aug 18, 2022
2 parents e490680 + dc6db48 commit 5a8d340
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions classes/Rest/Controllers/SupremmDataflowControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public function getQuality(Request $request, Application $app)
$params = array(':start' => $start, ':end' => $end);

$payload = array(
'success' => true
'success' => true,
'type' => $type
);
$reslist = $this->getreslist($start);

Expand Down Expand Up @@ -464,17 +465,16 @@ private function gpuqueuequery()
SELECT
DATE(d.day_start) AS day,
rf.code as resource,
ROUND(SUM(CASE sf.gpu0_nv_utilization_bucketid
SUM(CASE sf.gpu_usage_bucketid
WHEN 0 THEN 0
ELSE sf.node_time
END) / SUM(sf.node_time) * 100.0) AS percent
END) AS time_with_data, SUM(sf.node_time) AS total_time
FROM
modw_aggregates.supremmfact_by_day sf,
modw.days d,
modw.resourcefact rf
WHERE
sf.queue_id IN ('viz' , 'gpu', 'wjzheng')
AND sf.day_id = d.id
sf.day_id = d.id
AND rf.id = sf.resource_id
AND d.day_start >= :start
AND d.day_start <= :end
Expand All @@ -489,7 +489,7 @@ private function getjobscriptquery()
SELECT
DATE(FROM_UNIXTIME(jt.end_time_ts)) as day,
rf.code as resource,
COALESCE(ROUND(SUM(CASE WHEN js.tg_job_id IS NULL THEN 0 ELSE 1 END) / SUM(1) * 100.0), 'N/A') as percent
SUM(CASE WHEN js.tg_job_id IS NULL THEN 0 ELSE 1 END) AS time_with_data, SUM(1) AS total_time
FROM
modw.job_tasks jt
JOIN modw.resourcefact rf ON rf.id = jt.resource_id
Expand Down Expand Up @@ -524,7 +524,7 @@ private function getjobsquery($reftable, $cpudatarestriction, $reslist)
SELECT
alljobs.day,
alljobs.resource,
COALESCE(ROUND(100.0 * COALESCE(withcpu.jobs_ended_with_cpudata, 0.0) / alljobs.jobs_ended,0), 'N/A') as percent,
COALESCE(withcpu.jobs_ended_with_cpudata, 0.0) AS time_with_data, alljobs.jobs_ended AS total_time,
alljobs.jobs_ended,
COALESCE(withcpu.jobs_ended_with_cpudata, 0)
FROM
Expand Down Expand Up @@ -592,7 +592,7 @@ private function runquery($querystr, $params)
if (!isset($tabular[$result['resource']])) {
$tabular[$result['resource']] = array();
}
$tabular[$result['resource']][$result['day']] = $result['percent'];
$tabular[$result['resource']][$result['day']] = array('available' => $result['time_with_data'], 'total' => $result['total_time']);
}

return $tabular;
Expand Down

0 comments on commit 5a8d340

Please sign in to comment.