Skip to content

Commit

Permalink
Fix job array display.
Browse files Browse the repository at this point in the history
The current code has incomplete support for job arrays - only the
primary job identifier is shown. This change adds a new internal parameter
called provider_job_id which contains the `job index` for non-array
jobs and the `base_job_index[array_index]` for array jobs.

There is a corresponding pull request for the xmdod-supremm module
and for the xdmod-xsede module that should all be merged at the same
time.
  • Loading branch information
jpwhite4 committed May 5, 2023
1 parent b6bca52 commit d5b8794
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion classes/DataWarehouse/Query/Cloud/JobDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function __construct(
$this->joinTo($st, "systemaccount_id", "username", "username");

} else {
$this->addField(new TableField($factTable, "provider_identifier", "local_job_id"));
$this->addField(new TableField($factTable, "provider_identifier", "provider_job_id"));
$this->addField(new TableField($factTable, "instance_id", "jobid"));

$rt = new Table(new Schema("modw"), "resourcefact", "rf");
Expand Down
2 changes: 1 addition & 1 deletion classes/DataWarehouse/Query/Cloud/RawData.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct(
$this->addField(new TableField($resourcefactTable, "code", 'resource'));
$this->addField(new TableField($personTable, "long_name", "name"));

$this->addField(new TableField($factTable, "provider_identifier", "local_job_id"));
$this->addField(new TableField($factTable, "provider_identifier", "provider_job_id"));
$this->addField(new TableField($factTable, "instance_id", "jobid"));

$this->addTable($factTable);
Expand Down
3 changes: 2 additions & 1 deletion classes/DataWarehouse/Query/Gateways/JobDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public function __construct(
}
} else {
$this->addField(new TableField($factTable, "job_id", "jobid"));
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
$fta = $factTable->getAlias();
$this->addField(new FormulaField("CASE WHEN $fta.local_job_array_index = -1 THEN $fta.local_jobid ELSE CONCAT($fta.local_jobid, '[', $fta.local_job_array_index, ']') END", "provider_job_id"));

$rt = new Table(new Schema("modw"), "resourcefact", "rf");
$this->joinTo($rt, "task_resource_id", "code", "resource");
Expand Down
4 changes: 3 additions & 1 deletion classes/DataWarehouse/Query/Gateways/RawData.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ public function __construct(
$this->addField(new TableField($personTable, "long_name", "name"));

$this->addField(new TableField($factTable, "job_id", "jobid"));
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
$fta = $factTable->getAlias();
$this->addField(new FormulaField("CASE WHEN $fta.local_job_array_index = -1 THEN $fta.local_jobid ELSE CONCAT($fta.local_jobid, '[', $fta.local_job_array_index, ']') END", "provider_job_id"));
$this->addField(new TableField($factTable, 'start_time_ts'));
$this->addField(new TableField($factTable, 'end_time_ts'));
$this->addField(new FormulaField('-1', 'cpu_user'));
$this->addField(new FormulaField('COALESCE(LEAST(jt.wallduration / jt.timelimit, 1), -1)', 'walltime_accuracy'));

// This is used by Integrations and not currently shown on the XDMoD interface
$this->addField(new TableField($factTable, 'name', 'job_name'));
Expand Down
3 changes: 2 additions & 1 deletion classes/DataWarehouse/Query/Jobs/JobDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public function __construct(
}
} else {
$this->addField(new TableField($factTable, "job_id", "jobid"));
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
$fta = $factTable->getAlias();
$this->addField(new FormulaField("CASE WHEN $fta.local_job_array_index = -1 THEN $fta.local_jobid ELSE CONCAT($fta.local_jobid, '[', $fta.local_job_array_index, ']') END", "provider_job_id"));

$rt = new Table(new Schema("modw"), "resourcefact", "rf");
$this->joinTo($rt, "task_resource_id", "code", "resource");
Expand Down
3 changes: 2 additions & 1 deletion classes/DataWarehouse/Query/Jobs/RawData.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public function __construct(
$this->addField(new TableField($personTable, "long_name", "name"));

$this->addField(new TableField($factTable, "job_id", "jobid"));
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
$fta = $factTable->getAlias();
$this->addField(new FormulaField("CASE WHEN $fta.local_job_array_index = -1 THEN $fta.local_jobid ELSE CONCAT($fta.local_jobid, '[', $fta.local_job_array_index, ']') END", "provider_job_id"));
$this->addField(new TableField($factTable, 'start_time_ts'));
$this->addField(new TableField($factTable, 'end_time_ts'));
$this->addField(new FormulaField('-1', 'cpu_user'));
Expand Down
9 changes: 5 additions & 4 deletions classes/Rest/Controllers/WarehouseControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ protected function getJobPeers(Application $app, XDUser $user, $realm, $jobId, $
'ref' => array(
'realm' => $realm,
'jobid' => $jobId,
"text" => $thisjob['resource'] . '-' . $thisjob['local_job_id']
"text" => $thisjob['resource'] . '-' . $thisjob['provider_job_id']
)
)
);
Expand All @@ -1486,11 +1486,11 @@ protected function getJobPeers(Application $app, XDUser $user, $realm, $jobId, $
'ref' => array(
'realm' => $realm,
'jobid' => $jobpeer['jobid'],
'local_job_id' => $jobpeer['local_job_id'],
'local_job_id' => $jobpeer['provider_job_id'],
'resource' => $jobpeer['resource']
)
);
$result['categories'][] = $jobpeer['resource'] . '-' . $jobpeer['local_job_id'];
$result['categories'][] = $jobpeer['resource'] . '-' . $jobpeer['provider_job_id'];
}
}

Expand Down Expand Up @@ -2153,7 +2153,8 @@ private function getJobByPrimaryKey(Application $app, \XDUser $user, $realm, $se

$results = array();
foreach ($dataSet->getResults() as $result) {
$result['text'] = $result['resource'] . "-" . $result['local_job_id'];
$result['text'] = $result['resource'] . "-" . $result['provider_job_id'];
$result['local_job_id'] = $result['provider_job_id'];
$result['dtype'] = 'jobid';
array_push($results, $result);
}
Expand Down

0 comments on commit d5b8794

Please sign in to comment.