|
19 | 19 | from DIRAC import S_ERROR, S_OK, gConfig
|
20 | 20 | from DIRAC.AccountingSystem.Client.DataStoreClient import gDataStoreClient
|
21 | 21 | 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 | +) |
23 | 25 | from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals, Registry
|
24 | 26 | from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
25 | 27 | from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping
|
|
29 | 31 | from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager
|
30 | 32 | from DIRAC.FrameworkSystem.Client.TokenManagerClient import gTokenManager
|
31 | 33 | from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
|
| 34 | +from DIRAC.Resources.Computing.ComputingElement import ComputingElement |
32 | 35 | from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus
|
33 | 36 | from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus
|
34 |
| -from DIRAC.Resources.Computing.ComputingElement import ComputingElement |
35 | 37 | from DIRAC.WorkloadManagementSystem.Client import PilotStatus
|
36 |
| -from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES |
37 |
| - |
38 | 38 | from DIRAC.WorkloadManagementSystem.Client.MatcherClient import MatcherClient
|
| 39 | +from DIRAC.WorkloadManagementSystem.Client.PilotScopes import PILOT_SCOPES |
39 | 40 | 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 | +) |
41 | 44 | from DIRAC.WorkloadManagementSystem.Service.WMSUtilities import getGridEnv
|
42 | 45 | from DIRAC.WorkloadManagementSystem.Utilities.PilotWrapper import (
|
43 | 46 | _writePilotWrapperFile,
|
@@ -126,25 +129,24 @@ def initialize(self):
|
126 | 129 | self.gridEnv = getGridEnv()
|
127 | 130 |
|
128 | 131 | # 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", "") |
| 132 | + self.vo = self.am_getOption("VO", self.am_getOption("Community", "")) |
132 | 133 | if not self.vo:
|
133 | 134 | self.vo = CSGlobals.getVO()
|
| 135 | + if not self.vo: |
| 136 | + return S_ERROR("Need a VO") |
134 | 137 | # The SiteDirector is for a particular user group
|
135 | 138 | self.group = self.am_getOption("Group", "")
|
136 | 139 |
|
137 | 140 | # Choose the group for which pilots will be submitted. This is a hack until
|
138 | 141 | # we will be able to match pilots to VOs.
|
139 | 142 | 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) |
| 143 | + result = Registry.getGroupsForVO(self.vo) |
| 144 | + if not result["OK"]: |
| 145 | + return result |
| 146 | + self.voGroups = [] |
| 147 | + for group in result["Value"]: |
| 148 | + if "NormalUser" in Registry.getPropertiesForGroup(group): |
| 149 | + self.voGroups.append(group) |
148 | 150 | else:
|
149 | 151 | self.voGroups = [self.group]
|
150 | 152 |
|
@@ -570,8 +572,7 @@ def _getTQDictForMatching(self):
|
570 | 572 | :returns dict: tqDict of task queue descriptions
|
571 | 573 | """
|
572 | 574 | tqDict = {"Setup": CSGlobals.getSetup(), "CPUTime": 9999999}
|
573 |
| - if self.vo: |
574 |
| - tqDict["Community"] = self.vo |
| 575 | + tqDict["Community"] = self.vo |
575 | 576 | if self.voGroups:
|
576 | 577 | tqDict["OwnerGroup"] = self.voGroups
|
577 | 578 |
|
@@ -667,8 +668,7 @@ def _getCE(self, queue):
|
667 | 668 |
|
668 | 669 | if self.queueDict[queue]["Site"] not in self.siteMaskList:
|
669 | 670 | ceDict["JobType"] = "Test"
|
670 |
| - if self.vo: |
671 |
| - ceDict["Community"] = self.vo |
| 671 | + ceDict["Community"] = self.vo |
672 | 672 | if self.voGroups:
|
673 | 673 | ceDict["OwnerGroup"] = self.voGroups
|
674 | 674 |
|
@@ -1049,8 +1049,7 @@ def _getPilotOptions(self, queue, **kwargs):
|
1049 | 1049 | # SiteName
|
1050 | 1050 | pilotOptions.append(f"-n {queueDict['Site']}")
|
1051 | 1051 | # VO
|
1052 |
| - if self.vo: |
1053 |
| - pilotOptions.append(f"--wnVO={self.vo}") |
| 1052 | + pilotOptions.append(f"--wnVO={self.vo}") |
1054 | 1053 |
|
1055 | 1054 | # Generic Options
|
1056 | 1055 | if "GenericOptions" in queueDict:
|
|
0 commit comments