Skip to content

Add support for job array information in the job viewer. #1640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: xdmod10.5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions classes/DataWarehouse/Query/RawQueryTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ abstract class RawQueryTypes
const TIMESERIES_METRICS = 6;
const ANALYTICS = 7;
const VM_INSTANCE = 8;
const ARRAY_PEERS = 9;
}
92 changes: 92 additions & 0 deletions classes/Rest/Controllers/WarehouseControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ class WarehouseControllerProvider extends BaseControllerProvider
'type' => 'ganttchart',
"leaf" => true
),
\DataWarehouse\Query\RawQueryTypes::ARRAY_PEERS =>
array(
"infoid" => \DataWarehouse\Query\RawQueryTypes::ARRAY_PEERS,
"dtype" => "infoid",
"text" => "Job Array Peers",
'url' => '/rest/v1.0/warehouse/search/jobs/array',
'documentation' => 'Shows the list of other HPC jobs that were part of the same job array.',
'type' => 'ganttchart',
"leaf" => true
),
\DataWarehouse\Query\RawQueryTypes::NORMALIZED_METRICS =>
array(
"infoid" => \DataWarehouse\Query\RawQueryTypes::NORMALIZED_METRICS,
Expand Down Expand Up @@ -1399,6 +1409,11 @@ public function processJobSearchByAction(Request $request, Application $app, XDU
$limit = $this->getIntParam($request, 'limit', true);
$results = $this->getJobPeers($app, $user, $realm, $jobId, $start, $limit);
break;
case 'array':
$start = $this->getIntParam($request, 'start', true);
$limit = $this->getIntParam($request, 'limit', true);
$results = $this->getJobArrayPeers($app, $user, $realm, $jobId, $start, $limit);
break;
case 'executable':
$results = $this->getJobExecutable($app, $user, $realm, $jobId, $action, $actionName);
break;
Expand Down Expand Up @@ -1430,6 +1445,83 @@ public function processJobSearchByAction(Request $request, Application $app, XDU
return $results;
}

/**
* Return data about a job's array peers.
*
* @param Application $app The router application.
* @param XDUser $user the logged in user.
* @param $realm data realm.
* @param $jobId the unique identifier for the job.
* @param $start the start offset (for store paging).
* @param $limit the number of records to return (for store paging).
* @return json in Extjs.store parsable format.
*/
protected function getJobArrayPeers(Application $app, XDUser $user, $realm, $jobId, $start, $limit)
{
$jobdata = $this->getJobDataSet($user, $realm, $jobId, 'internal');
if (!$jobdata->hasResults()) {
throw new NotFoundException();
}
$jobresults = $jobdata->getResults();
$thisjob = $jobresults[0];

$i = 0;

$result = array(
'series' => array(
array(
'name' => 'Walltime',
'data' => array(
array(
'x' => $i++,
'low' => $thisjob['start_time_ts'] * 1000.0,
'high' => $thisjob['end_time_ts'] * 1000.0
)
)
),
array(
'name' => 'Walltime',
'data' => array()
)
),
'categories' => array(
'Current'
),
'schema' => array(
'timezone' => $thisjob['timezone'],
'ref' => array(
'realm' => $realm,
'jobid' => $jobId,
"text" => $thisjob['resource'] . '-' . $thisjob['local_job_id']
)
)
);

$dataset = $this->getJobDataSet($user, $realm, $jobId, 'array');
foreach ($dataset->getResults() as $index => $jobpeer) {
if (($index >= $start) && ($index < ($start + $limit))) {
$result['series'][1]['data'][] = array(
'x' => $i++,
'low' => $jobpeer['start_time_ts'] * 1000.0,
'high' => $jobpeer['end_time_ts'] * 1000.0,
'ref' => array(
'realm' => $realm,
'jobid' => $jobpeer['jobid'],
'local_job_id' => $jobpeer['local_job_id'],
'resource' => $jobpeer['resource']
)
);
$result['categories'][] = $jobpeer['resource'] . '-' . $jobpeer['local_job_id'];
}
}

return $app->json(array(
'success' => true,
'data' => array($result),
'total' => count($dataset->getResults())
));
}

/**
* Return data about a job's peers.
*
Expand Down