Skip to content

Commit 8de5107

Browse files
authored
Merge pull request #7263 from fstagni/mandatoryVO
[v9] fix: SiteDirector acts for a VO
2 parents d9df60c + eb9d9ab commit 8de5107

File tree

2 files changed

+14
-44
lines changed

2 files changed

+14
-44
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
from DIRAC import S_ERROR, S_OK, gConfig
2020
from DIRAC.AccountingSystem.Client.DataStoreClient import gDataStoreClient
2121
from DIRAC.AccountingSystem.Client.Types.Pilot import Pilot as PilotAccounting
22-
from DIRAC.AccountingSystem.Client.Types.PilotSubmission import PilotSubmission as PilotSubmissionAccounting
22+
from DIRAC.AccountingSystem.Client.Types.PilotSubmission import (
23+
PilotSubmission as PilotSubmissionAccounting,
24+
)
2325
from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals, Registry
2426
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
2527
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping
@@ -29,15 +31,16 @@
2931
from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager
3032
from DIRAC.FrameworkSystem.Client.TokenManagerClient import gTokenManager
3133
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
34+
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
3235
from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus
3336
from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus
34-
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
3537
from DIRAC.WorkloadManagementSystem.Client import PilotStatus
36-
from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES
37-
3838
from DIRAC.WorkloadManagementSystem.Client.MatcherClient import MatcherClient
39+
from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES
3940
from DIRAC.WorkloadManagementSystem.Client.ServerUtils import getPilotAgentsDB
40-
from DIRAC.WorkloadManagementSystem.private.ConfigHelper import findGenericPilotCredentials
41+
from DIRAC.WorkloadManagementSystem.private.ConfigHelper import (
42+
findGenericPilotCredentials,
43+
)
4144
from DIRAC.WorkloadManagementSystem.Service.WMSUtilities import getGridEnv
4245
from DIRAC.WorkloadManagementSystem.Utilities.PilotWrapper import (
4346
_writePilotWrapperFile,
@@ -78,9 +81,6 @@ def __init__(self, *args, **kwargs):
7881

7982
self.gridEnv = ""
8083
self.vo = ""
81-
self.group = ""
82-
# self.voGroups contain all the eligible user groups for pilots submitted by this SiteDirector
83-
self.voGroups = []
8484
self.pilotDN = ""
8585
self.pilotGroup = ""
8686
self.platforms = []
@@ -126,27 +126,11 @@ def initialize(self):
126126
self.gridEnv = getGridEnv()
127127

128128
# The SiteDirector is for a particular user community
129-
self.vo = self.am_getOption("VO", "")
130-
if not self.vo:
131-
self.vo = self.am_getOption("Community", "")
129+
self.vo = self.am_getOption("VO", self.am_getOption("Community", ""))
132130
if not self.vo:
133131
self.vo = CSGlobals.getVO()
134-
# The SiteDirector is for a particular user group
135-
self.group = self.am_getOption("Group", "")
136-
137-
# Choose the group for which pilots will be submitted. This is a hack until
138-
# we will be able to match pilots to VOs.
139-
if not self.group:
140-
if self.vo:
141-
result = Registry.getGroupsForVO(self.vo)
142-
if not result["OK"]:
143-
return result
144-
self.voGroups = []
145-
for group in result["Value"]:
146-
if "NormalUser" in Registry.getPropertiesForGroup(group):
147-
self.voGroups.append(group)
148-
else:
149-
self.voGroups = [self.group]
132+
if not self.vo:
133+
return S_ERROR("Need a VO")
150134

151135
# Get the clients
152136
self.siteClient = SiteStatus()
@@ -225,8 +209,6 @@ def beginExecution(self):
225209
tags = None
226210

227211
self.log.always("VO:", self.vo)
228-
if self.voGroups:
229-
self.log.always("Group(s):", self.voGroups)
230212
self.log.always("Sites:", siteNames)
231213
self.log.always("CETypes:", ceTypes)
232214
self.log.always("CEs:", ces)
@@ -570,10 +552,7 @@ def _getTQDictForMatching(self):
570552
:returns dict: tqDict of task queue descriptions
571553
"""
572554
tqDict = {"Setup": CSGlobals.getSetup(), "CPUTime": 9999999}
573-
if self.vo:
574-
tqDict["Community"] = self.vo
575-
if self.voGroups:
576-
tqDict["OwnerGroup"] = self.voGroups
555+
tqDict["Community"] = self.vo
577556

578557
if self.checkPlatform:
579558
platforms = self._getPlatforms()
@@ -667,10 +646,7 @@ def _getCE(self, queue):
667646

668647
if self.queueDict[queue]["Site"] not in self.siteMaskList:
669648
ceDict["JobType"] = "Test"
670-
if self.vo:
671-
ceDict["Community"] = self.vo
672-
if self.voGroups:
673-
ceDict["OwnerGroup"] = self.voGroups
649+
ceDict["Community"] = self.vo
674650

675651
if self.checkPlatform:
676652
platform = self.queueDict[queue]["ParametersDict"].get("Platform")
@@ -1049,8 +1025,7 @@ def _getPilotOptions(self, queue, **kwargs):
10491025
# SiteName
10501026
pilotOptions.append(f"-n {queueDict['Site']}")
10511027
# VO
1052-
if self.vo:
1053-
pilotOptions.append(f"--wnVO={self.vo}")
1028+
pilotOptions.append(f"--wnVO={self.vo}")
10541029

10551030
# Generic Options
10561031
if "GenericOptions" in queueDict:
@@ -1070,9 +1045,6 @@ def _getPilotOptions(self, queue, **kwargs):
10701045
if "PipInstallOptions" in queueDict:
10711046
pilotOptions.append(f"--pipInstallOptions={queueDict['PipInstallOptions']}")
10721047

1073-
if self.group:
1074-
pilotOptions.append(f"-G {self.group}")
1075-
10761048
return pilotOptions
10771049

10781050
####################################################################################

src/DIRAC/WorkloadManagementSystem/ConfigTemplate.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ Agents
282282
VO =
283283
# VO treated (leave empty for auto-discovery)
284284
Community =
285-
# Group treated (leave empty for auto-discovery)
286-
Group =
287285
# Grid Environment (leave empty for auto-discovery)
288286
GridEnv =
289287
# the DN of the certificate proxy used to submit pilots. If not found here, what is in Operations/Pilot section of the CS will be used

0 commit comments

Comments
 (0)