Skip to content

Commit

Permalink
feat: SD will always bundle proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Sep 13, 2024
1 parent 83219e3 commit cac067e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion docs/source/AdministratorGuide/Tutorials/installWMS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit cac067e

Please sign in to comment.