Skip to content

Commit

Permalink
fix: SiteDirector acts for a VO
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Oct 31, 2023
1 parent 90ec210 commit dcd89c1
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
from DIRAC import S_ERROR, S_OK, gConfig
from DIRAC.AccountingSystem.Client.DataStoreClient import gDataStoreClient
from DIRAC.AccountingSystem.Client.Types.Pilot import Pilot as PilotAccounting
from DIRAC.AccountingSystem.Client.Types.PilotSubmission import PilotSubmission as PilotSubmissionAccounting
from DIRAC.AccountingSystem.Client.Types.PilotSubmission import (
PilotSubmission as PilotSubmissionAccounting,
)
from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals, Registry
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping
Expand All @@ -29,15 +31,16 @@
from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager
from DIRAC.FrameworkSystem.Client.TokenManagerClient import gTokenManager
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus
from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
from DIRAC.WorkloadManagementSystem.Client import PilotStatus
from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES

from DIRAC.WorkloadManagementSystem.Client.MatcherClient import MatcherClient
from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES
from DIRAC.WorkloadManagementSystem.Client.ServerUtils import getPilotAgentsDB
from DIRAC.WorkloadManagementSystem.private.ConfigHelper import findGenericPilotCredentials
from DIRAC.WorkloadManagementSystem.private.ConfigHelper import (
findGenericPilotCredentials,
)
from DIRAC.WorkloadManagementSystem.Service.WMSUtilities import getGridEnv
from DIRAC.WorkloadManagementSystem.Utilities.PilotWrapper import (
_writePilotWrapperFile,
Expand Down Expand Up @@ -126,25 +129,24 @@ def initialize(self):
self.gridEnv = getGridEnv()

# The SiteDirector is for a particular user community
self.vo = self.am_getOption("VO", "")
if not self.vo:
self.vo = self.am_getOption("Community", "")
self.vo = self.am_getOption("VO", self.am_getOption("Community", ""))
if not self.vo:
self.vo = CSGlobals.getVO()
if not self.vo:
return S_ERROR("Need a VO")
# The SiteDirector is for a particular user group
self.group = self.am_getOption("Group", "")

# Choose the group for which pilots will be submitted. This is a hack until
# we will be able to match pilots to VOs.
if not self.group:
if self.vo:
result = Registry.getGroupsForVO(self.vo)
if not result["OK"]:
return result
self.voGroups = []
for group in result["Value"]:
if "NormalUser" in Registry.getPropertiesForGroup(group):
self.voGroups.append(group)
result = Registry.getGroupsForVO(self.vo)
if not result["OK"]:
return result
self.voGroups = []
for group in result["Value"]:
if "NormalUser" in Registry.getPropertiesForGroup(group):
self.voGroups.append(group)
else:
self.voGroups = [self.group]

Expand Down Expand Up @@ -570,8 +572,7 @@ def _getTQDictForMatching(self):
:returns dict: tqDict of task queue descriptions
"""
tqDict = {"Setup": CSGlobals.getSetup(), "CPUTime": 9999999}
if self.vo:
tqDict["Community"] = self.vo
tqDict["Community"] = self.vo
if self.voGroups:
tqDict["OwnerGroup"] = self.voGroups

Expand Down Expand Up @@ -667,8 +668,7 @@ def _getCE(self, queue):

if self.queueDict[queue]["Site"] not in self.siteMaskList:
ceDict["JobType"] = "Test"
if self.vo:
ceDict["Community"] = self.vo
ceDict["Community"] = self.vo
if self.voGroups:
ceDict["OwnerGroup"] = self.voGroups

Expand Down Expand Up @@ -1041,8 +1041,7 @@ def _getPilotOptions(self, queue, **kwargs):
# SiteName
pilotOptions.append(f"-n {queueDict['Site']}")
# VO
if self.vo:
pilotOptions.append(f"--wnVO={self.vo}")
pilotOptions.append(f"--wnVO={self.vo}")

# Generic Options
if "GenericOptions" in queueDict:
Expand Down

0 comments on commit dcd89c1

Please sign in to comment.