From 9643f4b3b00f98b5508c0bd772336ec97d848b7e Mon Sep 17 00:00:00 2001 From: aldbr Date: Thu, 7 Dec 2023 08:48:01 +0100 Subject: [PATCH] fix: remove valid arg from setToken --- src/DIRAC/Resources/Computing/AREXComputingElement.py | 4 ++-- src/DIRAC/Resources/Computing/ComputingElement.py | 3 +-- src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/DIRAC/Resources/Computing/AREXComputingElement.py b/src/DIRAC/Resources/Computing/AREXComputingElement.py index efb756641e1..085f8107c9c 100755 --- a/src/DIRAC/Resources/Computing/AREXComputingElement.py +++ b/src/DIRAC/Resources/Computing/AREXComputingElement.py @@ -96,13 +96,13 @@ def _reset(self): ############################################################################# - def setToken(self, token, valid): + def setToken(self, token): """Set the token and update the headers :param token: OAuth2Token object or dictionary containing token structure :param int valid: validity period in seconds """ - super().setToken(token, valid) + super().setToken(token) self.headers["Authorization"] = "Bearer " + self.token["access_token"] def _arcIDToJobReference(self, arcJobID): diff --git a/src/DIRAC/Resources/Computing/ComputingElement.py b/src/DIRAC/Resources/Computing/ComputingElement.py index 1fe8c9a10d4..39dcaded75d 100755 --- a/src/DIRAC/Resources/Computing/ComputingElement.py +++ b/src/DIRAC/Resources/Computing/ComputingElement.py @@ -102,9 +102,8 @@ def setProxy(self, proxy, valid=0): self.proxy = proxy self.valid = datetime.datetime.utcnow() + second * valid - def setToken(self, token, valid=0): + def setToken(self, token): self.token = token - self.valid = datetime.datetime.utcnow() + second * valid def _prepareProxy(self): """Set the environment variable X509_USER_PROXY""" diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py b/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py index 27ccfa62128..1ae5edeb849 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py @@ -451,7 +451,7 @@ def submitPilots(self): result = self.__getPilotToken(audience=ce.audienceName) if not result["OK"]: return result - ce.setToken(result["Value"], 3500) + ce.setToken(result["Value"]) # now really submitting res = self._submitPilotsToQueue(pilotsToSubmit, ce, queueName) @@ -1267,7 +1267,7 @@ def _updatePilotStatusPerQueue(self, queue, proxy): if not result["OK"]: self.log.error("Failed to get token", f"{ceName}: {result['Message']}") return - ce.setToken(result["Value"], 3500) + ce.setToken(result["Value"]) result = ce.getJobStatus(stampedPilotRefs) if not result["OK"]: