Skip to content

Commit 178e0c0

Browse files
authored
Merge pull request #7208 from aldbr/v8.0_FEAT_PilotSubWithTokenMultiVO
[8.0] feat: pilot submission with tokens in a multi-VO setup
2 parents 003ccc1 + 1e683ea commit 178e0c0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
3232
from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus
3333
from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus
34+
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
3435
from DIRAC.WorkloadManagementSystem.Client import PilotStatus
3536
from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES
3637

@@ -446,7 +447,7 @@ def submitPilots(self):
446447
ce.setProxy(proxy, lifetime_secs)
447448

448449
# Get valid token if needed
449-
if "Token" in ce.ceParameters.get("Tag", []):
450+
if self.__supportToken(ce):
450451
result = self.__getPilotToken(audience=ce.audienceName)
451452
if not result["OK"]:
452453
return result
@@ -467,6 +468,14 @@ def submitPilots(self):
467468

468469
return S_OK()
469470

471+
def __supportToken(self, ce: ComputingElement) -> bool:
472+
"""Check whether the SiteDirector is able to submit pilots with tokens.
473+
474+
* the CE is able to receive any token. Validation: Tag = Token should be included in the CE parameters.
475+
* the CE is able to receive VO-specifc tokens. Validation: Tag = Token:<VO> should be included in the CE parameters.
476+
"""
477+
return "Token" in ce.ceParameters.get("Tag", []) or f"Token:{self.vo}" in ce.ceParameters.get("Tag", [])
478+
470479
def __getPilotToken(self, audience: str, scope: list[str] = None):
471480
"""Get the token corresponding to the pilot user identity
472481
@@ -1242,7 +1251,7 @@ def _updatePilotStatusPerQueue(self, queue, proxy):
12421251
ce.setProxy(proxy, 23300)
12431252

12441253
# Get valid token if needed
1245-
if "Token" in ce.ceParameters.get("Tag", []):
1254+
if self.__supportToken(ce):
12461255
result = self.__getPilotToken(audience=ce.audienceName)
12471256
if not result["OK"]:
12481257
self.log.error("Failed to get token", f"{ceName}: {result['Message']}")

0 commit comments

Comments
 (0)