From cac067e198fca2e549e41cb05c7baa47897c7f16 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Fri, 13 Sep 2024 10:21:11 +0200 Subject: [PATCH] feat: SD will always bundle proxy --- .../Systems/WorkloadManagement/tagsAndJobs.rst | 1 - .../AdministratorGuide/Tutorials/installWMS.rst | 1 - .../WorkloadManagementSystem/Agent/SiteDirector.py | 11 +++-------- .../Agent/test/Test_Agent_SiteDirector.py | 10 +++++++--- .../Utilities/QueueUtilities.py | 4 ---- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/docs/source/AdministratorGuide/Systems/WorkloadManagement/tagsAndJobs.rst b/docs/source/AdministratorGuide/Systems/WorkloadManagement/tagsAndJobs.rst index 6c1e087cca4..1e85686cb96 100644 --- a/docs/source/AdministratorGuide/Systems/WorkloadManagement/tagsAndJobs.rst +++ b/docs/source/AdministratorGuide/Systems/WorkloadManagement/tagsAndJobs.rst @@ -35,7 +35,6 @@ Let's take an example:: maxCPUTime = 200 MaxTotalJobs = 5 MaxWaitingJobs = 10 - BundleProxy = True RemoveOutput = True } # This queue has Tag = GPU. So it will accept: diff --git a/docs/source/AdministratorGuide/Tutorials/installWMS.rst b/docs/source/AdministratorGuide/Tutorials/installWMS.rst index 6a1e6e510c3..d4fb341d9ae 100644 --- a/docs/source/AdministratorGuide/Tutorials/installWMS.rst +++ b/docs/source/AdministratorGuide/Tutorials/installWMS.rst @@ -227,7 +227,6 @@ Then, as ``diracuser`` with the ``dirac_admin`` proxy, we need to define a CE in CPUTime = 40000 MaxTotalJobs = 5 MaxWaitingJobs = 10 - BundleProxy = True BatchError = /home/diracpilot/localsite/error ExecutableArea = /home/diracpilot/localsite/submission RemoveOutput = True diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py b/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py index 60781584a60..deefacb9a5f 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py @@ -731,15 +731,10 @@ def _submitPilotsToQueue(self, pilotsToSubmit, ce, queue): """ self.log.info("Going to submit pilots", f"(a maximum of {pilotsToSubmit} pilots to {queue} queue)") - bundleProxy = self.queueDict[queue].get("BundleProxy", False) - proxy = None - if bundleProxy: - proxy = ce.proxy - jobExecDir = self.queueDict[queue]["ParametersDict"].get("JobExecDir", "") envVariables = self.queueDict[queue]["ParametersDict"].get("EnvironmentVariables", None) - executable = self.getExecutable(queue, proxy=proxy, jobExecDir=jobExecDir, envVariables=envVariables) + executable = self.getExecutable(queue, proxy=ce.proxy, jobExecDir=jobExecDir, envVariables=envVariables) submitResult = ce.submitJob(executable, "", pilotsToSubmit) # In case the CE does not need the executable after the submission, we delete it @@ -956,7 +951,7 @@ def getExecutable(self, queue, proxy=None, jobExecDir="", envVariables=None, **k """Prepare the full executable for queue :param str queue: queue name - :param bool proxy: flag that say if to bundle or not the proxy + :param str proxy: proxy to bundle :param str jobExecDir: pilot execution dir (normally an empty string) :returns: a string the options for the pilot @@ -1087,7 +1082,7 @@ def _getPilotOptions(self, queue, **kwargs): #################################################################################### - def _writePilotScript(self, workingDirectory, pilotOptions, proxy=None, pilotExecDir="", envVariables=None): + def _writePilotScript(self, workingDirectory, pilotOptions, proxy, pilotExecDir="", envVariables=None): """Bundle together and write out the pilot executable script, admix the proxy if given :param str workingDirectory: pilot wrapper working directory diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py b/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py index ad343c7e89a..ffc6fd67d44 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py @@ -4,10 +4,11 @@ # imports import datetime -import pytest from unittest.mock import MagicMock -from DIRAC import gLogger +import pytest + +from DIRAC import S_OK, gLogger # sut from DIRAC.WorkloadManagementSystem.Agent.SiteDirector import SiteDirector @@ -179,10 +180,13 @@ def test__submitPilotsToQueue(sd): # This is to use the SiteDirector's working directory, not the CE one ceMock = MagicMock() del ceMock.workingDirectory + proxyObject_mock = MagicMock() + proxyObject_mock.dumpAllToString.return_value = S_OK("aProxy") + ceMock.proxy = proxyObject_mock sd.queueCECache = {"aQueue": {"CE": ceMock}} sd.queueSlots = {"aQueue": {"AvailableSlots": 10}} - assert sd._submitPilotsToQueue(1, MagicMock(), "aQueue")["OK"] + assert sd._submitPilotsToQueue(1, ceMock, "aQueue")["OK"] @pytest.mark.parametrize( diff --git a/src/DIRAC/WorkloadManagementSystem/Utilities/QueueUtilities.py b/src/DIRAC/WorkloadManagementSystem/Utilities/QueueUtilities.py index 70ef5bcf4ab..f3718b4734f 100644 --- a/src/DIRAC/WorkloadManagementSystem/Utilities/QueueUtilities.py +++ b/src/DIRAC/WorkloadManagementSystem/Utilities/QueueUtilities.py @@ -87,10 +87,6 @@ def getQueuesResolved( if checkPlatform: setPlatform(ceDict, queueDict[queueName]["ParametersDict"]) - bundleProxy = queueDict[queueName]["ParametersDict"].get("BundleProxy", ceDict.get("BundleProxy")) - if bundleProxy and bundleProxy.lower() in ["true", "yes", "1"]: - queueDict[queueName]["BundleProxy"] = True - return S_OK(queueDict)