From 130bd6ba0153143e1db700a0300a8b7924e17d9d Mon Sep 17 00:00:00 2001 From: aldbr Date: Fri, 10 Apr 2026 18:30:18 +0200 Subject: [PATCH] fix: move setCredentials back to its original location in SD --- .../Agent/SiteDirector.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py b/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py index 3ec19c137ab..418413adc84 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py @@ -302,6 +302,15 @@ def _submitPilotsPerQueue(self, queueName: str): self.failedQueues[queueName] += 1 return S_OK(0) + # Get CE instance + ce = self.queueDict[queueName]["CE"] + + # Set credentials: needed for authenticated CE operations (e.g. ce.available() on AREX) + result = self._setCredentials(ce, 3600) + if not result["OK"]: + self.log.error("Failed to set credentials:", result["Message"]) + return result + # Get the number of available slots on the target site/queue totalSlots, waitingPilots = self._getQueueSlots(queueName) if totalSlots <= 0: @@ -322,7 +331,6 @@ def _submitPilotsPerQueue(self, queueName: str): ) # Now really submitting - ce = self.queueDict[queueName]["CE"] result = self._submitPilotsToQueue(pilotsToSubmit, ce, queueName) if not result["OK"]: self.log.info("Failed pilot submission", f"Queue: {queueName}") @@ -439,12 +447,6 @@ def _submitPilotsToQueue(self, pilotsToSubmit: int, ce: ComputingElement, queue: jobProxy = result["Value"] executable = self._getExecutable(queue, proxy=jobProxy, jobExecDir=jobExecDir, envVariables=envVariables) - # Add the credentials to the CE - result = self._setCredentials(ce, 3600) - if not result["OK"]: - self.log.error("Failed to set credentials:", result["Message"]) - return result - # Submit the job submitResult = ce.submitJob(executable, "", pilotsToSubmit) # In case the CE does not need the executable after the submission, we delete it