Skip to content

Commit 2b3133b

Browse files
committed
Fix: Update AREX delegation renewal
1 parent 9fad0a0 commit 2b3133b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/DIRAC/Resources/Computing/AREXComputingElement.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def _getDelegationID(self, arcJobID):
232232
:param str jobID: ARC job ID
233233
:return: delegation ID
234234
"""
235+
params = {"action": "delegations"}
235236
query = self._urlJoin("jobs")
236237

237238
# Submit the POST request to get the delegation
@@ -240,6 +241,7 @@ def _getDelegationID(self, arcJobID):
240241
query,
241242
data=json.dumps(jobsJson),
242243
headers=self.headers,
244+
params=params,
243245
timeout=self.arcRESTTimeout,
244246
)
245247

@@ -253,8 +255,11 @@ def _getDelegationID(self, arcJobID):
253255
if "delegation_id" not in responseDelegation["job"]:
254256
return S_ERROR("Cannot find the Delegation ID for Job %s" % arcJobID)
255257

256-
delegationID = responseDelegation["job"]["delegation_id"][0]
257-
return S_OK(delegationID)
258+
delegationIDs = responseDelegation["job"]["delegation_id"]
259+
# Documentation says "Array", but a single string is returned if there is only one
260+
if not isinstance(delegationIDs, list):
261+
delegationIDs = [delegationIDs]
262+
return S_OK(delegationIDs[0])
258263

259264
#############################################################################
260265

@@ -538,7 +543,10 @@ def _renewJobs(self, arcJobList):
538543
if not res["OK"]:
539544
continue
540545

541-
timeLeft = proxy.getRemainingSecs()
546+
timeLeftRes = proxy.getRemainingSecs()
547+
if not timeLeftRes["OK"]:
548+
continue
549+
timeLeft = timeLeftRes["Value"]
542550
if timeLeft < self.proxyTimeLeftBeforeRenewal:
543551
self.log.debug(
544552
"Renewing proxy for job",

0 commit comments

Comments
 (0)