Skip to content

Commit a96df0d

Browse files
committed
fix: getJobParameters for the multi-VO case
1 parent 7fe25eb commit a96df0d

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/DIRAC/WorkloadManagementSystem/Service/JobMonitoringHandler.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,31 @@ def export_getJobParameters(self, jobIDs, parName=None):
270270
if not isinstance(jobIDs, list):
271271
jobIDs = [jobIDs]
272272
jobIDs = [int(jobID) for jobID in jobIDs]
273-
res = self.elasticJobParametersDB.getJobParameters(jobIDs, self.vo, parName)
274-
if not res["OK"]:
275-
return res
276-
parameters = res["Value"]
273+
if self.vo: # a user is connecting, with a proxy
274+
res = self.elasticJobParametersDB.getJobParameters(jobIDs, self.vo, parName)
275+
if not res["OK"]:
276+
return res
277+
parameters = res["Value"]
278+
else: # a service is connecting, no proxy, e.g. StalledJobAgent
279+
q = "SELECT JobID, VO FROM Jobs WHERE JobID IN (%s)" % ",".join([str(jobID) for jobID in jobIDs])
280+
res = self.jobDB._query(q)
281+
if not res["OK"]:
282+
return res
283+
if not res["Value"]:
284+
return S_OK({})
285+
# get the VO for each jobID
286+
voDict = {}
287+
for jobID, vo in res["Value"]:
288+
if vo not in voDict:
289+
voDict[vo] = []
290+
voDict[vo].append(jobID)
291+
# get the parameters for each VO
292+
parameters = {}
293+
for vo, jobIDs in voDict.items():
294+
res = self.elasticJobParametersDB.getJobParameters(jobIDs, vo, parName)
295+
if not res["OK"]:
296+
return res
297+
parameters.update(res["Value"])
277298

278299
# Need anyway to get also from JobDB, for those jobs with parameters registered in MySQL or in both backends
279300
res = self.jobDB.getJobParameters(jobIDs, parName)

0 commit comments

Comments
 (0)