Skip to content

Commit

Permalink
Merge pull request #7892 from sfayer/cherry-pick-2-37b625a44-integration
Browse files Browse the repository at this point in the history
[sweep:integration] Use plain proxy for pilot bundle
  • Loading branch information
fstagni authored Nov 18, 2024
2 parents 18e1661 + 88568c3 commit 7443bb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def __init__(self, *args, **kwargs):

self.workingDirectory = None
self.maxQueueLength = 86400 * 3
# Bundle proxy lifetime factor: Job bundled proxy lifetime will be this multiplied by the queue runtime length,
# should be high enough to accommodate the queuing time of the job.
self.bundleProxyLifetimeFactor = 1.5

def initialize(self):
"""Initial settings"""
Expand Down Expand Up @@ -446,7 +449,16 @@ def _submitPilotsToQueue(self, pilotsToSubmit: int, ce: ComputingElement, queue:
envVariables = self.queueDict[queue]["ParametersDict"].get("EnvironmentVariables", None)

# Generate the executable
executable = self._getExecutable(queue, proxy=ce.proxy, jobExecDir=jobExecDir, envVariables=envVariables)
# We don't want to use the submission/"pilot" proxy for the job in the bundle:
# Instead we use a non-VOMS proxy which is then not limited in lifetime by the VOMS extension
proxyTimeSec = int(self.maxQueueLength * self.bundleProxyLifetimeFactor)
pilotGroup = Operations(vo=self.vo).getValue("Pilot/GenericPilotGroup")
result = gProxyManager.downloadProxy(self.pilotDN, pilotGroup, limited=True, requiredTimeLeft=proxyTimeSec)
if not result["OK"]:
self.log.error("Failed to get job proxy", f"Queue {queue}:\n{result['Message']}")
return result
jobProxy = result["Value"]
executable = self._getExecutable(queue, proxy=jobProxy, jobExecDir=jobExecDir, envVariables=envVariables)

# Submit the job
submitResult = ce.submitJob(executable, "", pilotsToSubmit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@
}
"""

mockPMProxy = MagicMock()
mockPMProxy.dumpAllToString.return_value = {"OK": True, "Value": "fakeProxy"}
mockPMProxyReply = MagicMock()
mockPMProxyReply.return_value = {"OK": True, "Value": mockPMProxy}


@pytest.fixture
def config():
Expand All @@ -170,6 +175,9 @@ def sd(mocker, config):
mocker.patch(
"DIRAC.WorkloadManagementSystem.Agent.SiteDirector.ResourceStatus.getElementStatus", return_values=usableSites
)
mocker.patch(
"DIRAC.WorkloadManagementSystem.Agent.SiteDirector.gProxyManager.downloadProxy", side_effect=mockPMProxyReply
)
sd = SiteDirector()

# Set logger
Expand Down

0 comments on commit 7443bb0

Please sign in to comment.