Skip to content

Commit 5229916

Browse files
committed
Fix job array display.
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.
1 parent b6bca52 commit 5229916

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed

classes/DataWarehouse/Query/Cloud/JobDataset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function __construct(
113113
$this->joinTo($st, "systemaccount_id", "username", "username");
114114

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

119119
$rt = new Table(new Schema("modw"), "resourcefact", "rf");

classes/DataWarehouse/Query/Cloud/RawData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(
8282
$this->addField(new TableField($resourcefactTable, "code", 'resource'));
8383
$this->addField(new TableField($personTable, "long_name", "name"));
8484

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

8888
$this->addTable($factTable);

classes/DataWarehouse/Query/Gateways/JobDataset.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public function __construct(
123123
}
124124
} else {
125125
$this->addField(new TableField($factTable, "job_id", "jobid"));
126-
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
126+
$fta = $factTable->getAlias();
127+
$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"));
127128

128129
$rt = new Table(new Schema("modw"), "resourcefact", "rf");
129130
$this->joinTo($rt, "task_resource_id", "code", "resource");

classes/DataWarehouse/Query/Gateways/RawData.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ public function __construct(
8181
$this->addField(new TableField($personTable, "long_name", "name"));
8282

8383
$this->addField(new TableField($factTable, "job_id", "jobid"));
84-
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
84+
$fta = $factTable->getAlias();
85+
$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"));
8586
$this->addField(new TableField($factTable, 'start_time_ts'));
8687
$this->addField(new TableField($factTable, 'end_time_ts'));
8788
$this->addField(new FormulaField('-1', 'cpu_user'));
89+
$this->addField(new FormulaField('COALESCE(LEAST(jt.wallduration / jt.timelimit, 1), -1)', 'walltime_accuracy'));
8890

8991
// This is used by Integrations and not currently shown on the XDMoD interface
9092
$this->addField(new TableField($factTable, 'name', 'job_name'));

classes/DataWarehouse/Query/Jobs/JobDataset.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public function __construct(
123123
}
124124
} else {
125125
$this->addField(new TableField($factTable, "job_id", "jobid"));
126-
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
126+
$fta = $factTable->getAlias();
127+
$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"));
127128

128129
$rt = new Table(new Schema("modw"), "resourcefact", "rf");
129130
$this->joinTo($rt, "task_resource_id", "code", "resource");

classes/DataWarehouse/Query/Jobs/RawData.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function __construct(
8080
$this->addField(new TableField($personTable, "long_name", "name"));
8181

8282
$this->addField(new TableField($factTable, "job_id", "jobid"));
83-
$this->addField(new TableField($factTable, "local_jobid", "local_job_id"));
83+
$fta = $factTable->getAlias();
84+
$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"));
8485
$this->addField(new TableField($factTable, 'start_time_ts'));
8586
$this->addField(new TableField($factTable, 'end_time_ts'));
8687
$this->addField(new FormulaField('-1', 'cpu_user'));

classes/Rest/Controllers/WarehouseControllerProvider.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ public function processJobSearch(Request $request, Application $app, XDUser $use
13221322
$data = array();
13231323
foreach ($raw as $row) {
13241324
$resource = $row['resource'];
1325-
$localJobId = $row['local_job_id'];
1325+
$localJobId = $row['provider_job_id'];
13261326

13271327
$row['text'] = "$resource-$localJobId";
13281328
$row['dtype'] = 'jobid';
@@ -1471,7 +1471,7 @@ protected function getJobPeers(Application $app, XDUser $user, $realm, $jobId, $
14711471
'ref' => array(
14721472
'realm' => $realm,
14731473
'jobid' => $jobId,
1474-
"text" => $thisjob['resource'] . '-' . $thisjob['local_job_id']
1474+
"text" => $thisjob['resource'] . '-' . $thisjob['provider_job_id']
14751475
)
14761476
)
14771477
);
@@ -1486,11 +1486,11 @@ protected function getJobPeers(Application $app, XDUser $user, $realm, $jobId, $
14861486
'ref' => array(
14871487
'realm' => $realm,
14881488
'jobid' => $jobpeer['jobid'],
1489-
'local_job_id' => $jobpeer['local_job_id'],
1489+
'local_job_id' => $jobpeer['provider_job_id'],
14901490
'resource' => $jobpeer['resource']
14911491
)
14921492
);
1493-
$result['categories'][] = $jobpeer['resource'] . '-' . $jobpeer['local_job_id'];
1493+
$result['categories'][] = $jobpeer['resource'] . '-' . $jobpeer['provider_job_id'];
14941494
}
14951495
}
14961496

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

21542154
$results = array();
21552155
foreach ($dataSet->getResults() as $result) {
2156-
$result['text'] = $result['resource'] . "-" . $result['local_job_id'];
2156+
$result['text'] = $result['resource'] . "-" . $result['provider_job_id'];
2157+
$result['local_job_id'] = $result['provider_job_id'];
21572158
$result['dtype'] = 'jobid';
21582159
array_push($results, $result);
21592160
}

0 commit comments

Comments
 (0)