DIRAC 9.0.0a42__py3-none-any.whl → 9.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- DIRAC/AccountingSystem/Client/AccountingCLI.py +0 -140
- DIRAC/AccountingSystem/Client/DataStoreClient.py +0 -13
- DIRAC/AccountingSystem/Client/Types/BaseAccountingType.py +0 -7
- DIRAC/AccountingSystem/ConfigTemplate.cfg +0 -5
- DIRAC/AccountingSystem/Service/DataStoreHandler.py +0 -72
- DIRAC/ConfigurationSystem/Client/Helpers/CSGlobals.py +0 -9
- DIRAC/ConfigurationSystem/Client/Helpers/Registry.py +38 -26
- DIRAC/ConfigurationSystem/Client/Helpers/Resources.py +11 -43
- DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py +0 -16
- DIRAC/ConfigurationSystem/Client/LocalConfiguration.py +14 -8
- DIRAC/ConfigurationSystem/Client/PathFinder.py +47 -8
- DIRAC/ConfigurationSystem/Client/SyncPlugins/CERNLDAPSyncPlugin.py +4 -1
- DIRAC/ConfigurationSystem/Client/VOMS2CSSynchronizer.py +32 -19
- DIRAC/ConfigurationSystem/Client/test/Test_PathFinder.py +41 -1
- DIRAC/ConfigurationSystem/private/RefresherBase.py +4 -2
- DIRAC/Core/Base/API.py +4 -7
- DIRAC/Core/Base/SQLAlchemyDB.py +1 -0
- DIRAC/Core/DISET/ServiceReactor.py +11 -3
- DIRAC/Core/DISET/private/BaseClient.py +1 -2
- DIRAC/Core/DISET/private/Transports/M2SSLTransport.py +9 -7
- DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py +3 -1
- DIRAC/Core/LCG/GOCDBClient.py +5 -7
- DIRAC/Core/Security/DiracX.py +31 -17
- DIRAC/Core/Security/IAMService.py +5 -10
- DIRAC/Core/Security/Locations.py +27 -18
- DIRAC/Core/Security/ProxyInfo.py +9 -5
- DIRAC/Core/Security/VOMSService.py +2 -4
- DIRAC/Core/Security/m2crypto/X509Certificate.py +4 -6
- DIRAC/Core/Security/m2crypto/asn1_utils.py +17 -5
- DIRAC/Core/Security/test/test_diracx_token_from_pem.py +161 -0
- DIRAC/Core/Tornado/Client/ClientSelector.py +4 -1
- DIRAC/Core/Tornado/Server/TornadoService.py +1 -1
- DIRAC/Core/Utilities/CGroups2.py +328 -0
- DIRAC/Core/Utilities/ClassAd/ClassAdLight.py +4 -290
- DIRAC/Core/Utilities/DErrno.py +5 -309
- DIRAC/Core/Utilities/Extensions.py +10 -1
- DIRAC/Core/Utilities/File.py +1 -1
- DIRAC/Core/Utilities/Graphs/GraphData.py +1 -1
- DIRAC/Core/Utilities/Graphs/GraphUtilities.py +6 -1
- DIRAC/Core/Utilities/JDL.py +1 -195
- DIRAC/Core/Utilities/List.py +1 -124
- DIRAC/Core/Utilities/MySQL.py +103 -99
- DIRAC/Core/Utilities/Os.py +32 -1
- DIRAC/Core/Utilities/Platform.py +2 -107
- DIRAC/Core/Utilities/Proxy.py +0 -4
- DIRAC/Core/Utilities/ReturnValues.py +7 -252
- DIRAC/Core/Utilities/StateMachine.py +12 -178
- DIRAC/Core/Utilities/Subprocess.py +35 -14
- DIRAC/Core/Utilities/TimeUtilities.py +10 -253
- DIRAC/Core/Utilities/test/Test_JDL.py +0 -3
- DIRAC/Core/Utilities/test/Test_Profiler.py +20 -20
- DIRAC/Core/scripts/dirac_agent.py +1 -1
- DIRAC/Core/scripts/dirac_apptainer_exec.py +72 -46
- DIRAC/Core/scripts/dirac_configure.py +1 -3
- DIRAC/Core/scripts/dirac_install_db.py +24 -6
- DIRAC/Core/scripts/dirac_platform.py +1 -92
- DIRAC/DataManagementSystem/Agent/FTS3Agent.py +8 -7
- DIRAC/DataManagementSystem/Agent/RequestOperations/RemoveFile.py +7 -6
- DIRAC/DataManagementSystem/Client/FTS3Job.py +71 -34
- DIRAC/DataManagementSystem/DB/FTS3DB.py +7 -3
- DIRAC/DataManagementSystem/DB/FileCatalogComponents/DatasetManager/DatasetManager.py +1 -1
- DIRAC/DataManagementSystem/DB/FileCatalogDB.sql +9 -9
- DIRAC/DataManagementSystem/DB/FileCatalogWithFkAndPsDB.sql +9 -9
- DIRAC/DataManagementSystem/Utilities/DMSHelpers.py +6 -2
- DIRAC/DataManagementSystem/scripts/dirac_admin_allow_se.py +13 -8
- DIRAC/DataManagementSystem/scripts/dirac_admin_ban_se.py +13 -8
- DIRAC/DataManagementSystem/scripts/dirac_dms_create_moving_request.py +2 -0
- DIRAC/DataManagementSystem/scripts/dirac_dms_protocol_matrix.py +0 -1
- DIRAC/FrameworkSystem/Client/BundleDeliveryClient.py +2 -7
- DIRAC/FrameworkSystem/Client/ComponentInstaller.py +9 -4
- DIRAC/FrameworkSystem/Client/ProxyManagerClient.py +5 -2
- DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py +11 -6
- DIRAC/FrameworkSystem/ConfigTemplate.cfg +2 -0
- DIRAC/FrameworkSystem/DB/AuthDB.py +3 -3
- DIRAC/FrameworkSystem/DB/InstalledComponentsDB.py +4 -4
- DIRAC/FrameworkSystem/DB/ProxyDB.py +11 -3
- DIRAC/FrameworkSystem/DB/TokenDB.py +1 -1
- DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py +8 -6
- DIRAC/FrameworkSystem/Utilities/MonitoringUtilities.py +2 -19
- DIRAC/FrameworkSystem/Utilities/TokenManagementUtilities.py +3 -2
- DIRAC/FrameworkSystem/Utilities/diracx.py +36 -14
- DIRAC/FrameworkSystem/private/authorization/AuthServer.py +2 -2
- DIRAC/FrameworkSystem/scripts/dirac_admin_update_pilot.py +18 -11
- DIRAC/FrameworkSystem/scripts/dirac_login.py +2 -2
- DIRAC/FrameworkSystem/scripts/dirac_proxy_init.py +7 -8
- DIRAC/Interfaces/API/Dirac.py +27 -15
- DIRAC/Interfaces/API/DiracAdmin.py +45 -17
- DIRAC/Interfaces/API/Job.py +9 -13
- DIRAC/Interfaces/scripts/dirac_admin_allow_site.py +12 -18
- DIRAC/Interfaces/scripts/dirac_admin_ban_site.py +12 -10
- DIRAC/Interfaces/scripts/dirac_admin_get_site_mask.py +4 -13
- DIRAC/Interfaces/scripts/dirac_admin_reset_job.py +3 -6
- DIRAC/Interfaces/scripts/dirac_wms_job_parameters.py +0 -1
- DIRAC/MonitoringSystem/Client/Types/WMSHistory.py +4 -0
- DIRAC/MonitoringSystem/Client/WebAppClient.py +26 -0
- DIRAC/MonitoringSystem/ConfigTemplate.cfg +9 -0
- DIRAC/MonitoringSystem/DB/MonitoringDB.py +6 -25
- DIRAC/MonitoringSystem/Service/MonitoringHandler.py +0 -33
- DIRAC/MonitoringSystem/Service/WebAppHandler.py +599 -0
- DIRAC/MonitoringSystem/private/MainReporter.py +0 -3
- DIRAC/ProductionSystem/DB/ProductionDB.sql +4 -4
- DIRAC/ProductionSystem/scripts/dirac_prod_get.py +2 -2
- DIRAC/ProductionSystem/scripts/dirac_prod_get_all.py +2 -2
- DIRAC/ProductionSystem/scripts/dirac_prod_get_trans.py +2 -3
- DIRAC/RequestManagementSystem/Agent/RequestExecutingAgent.py +8 -6
- DIRAC/RequestManagementSystem/Agent/RequestOperations/ForwardDISET.py +2 -14
- DIRAC/RequestManagementSystem/Client/ReqClient.py +66 -13
- DIRAC/RequestManagementSystem/ConfigTemplate.cfg +6 -6
- DIRAC/RequestManagementSystem/DB/RequestDB.py +10 -5
- DIRAC/RequestManagementSystem/DB/test/RMSTestScenari.py +2 -0
- DIRAC/RequestManagementSystem/private/RequestValidator.py +40 -46
- DIRAC/ResourceStatusSystem/Client/SiteStatus.py +4 -2
- DIRAC/ResourceStatusSystem/Command/FreeDiskSpaceCommand.py +3 -1
- DIRAC/ResourceStatusSystem/DB/ResourceManagementDB.py +8 -8
- DIRAC/ResourceStatusSystem/DB/ResourceStatusDB.py +2 -2
- DIRAC/ResourceStatusSystem/Utilities/CSHelpers.py +2 -31
- DIRAC/ResourceStatusSystem/scripts/dirac_rss_set_status.py +30 -12
- DIRAC/Resources/Catalog/RucioFileCatalogClient.py +195 -1
- DIRAC/Resources/Catalog/test/Test_RucioFileCatalogClient.py +181 -0
- DIRAC/Resources/Computing/AREXComputingElement.py +25 -8
- DIRAC/Resources/Computing/BatchSystems/Condor.py +126 -108
- DIRAC/Resources/Computing/BatchSystems/SLURM.py +5 -1
- DIRAC/Resources/Computing/BatchSystems/test/Test_SLURM.py +46 -0
- DIRAC/Resources/Computing/ComputingElement.py +1 -1
- DIRAC/Resources/Computing/HTCondorCEComputingElement.py +44 -44
- DIRAC/Resources/Computing/InProcessComputingElement.py +4 -2
- DIRAC/Resources/Computing/LocalComputingElement.py +1 -18
- DIRAC/Resources/Computing/SSHBatchComputingElement.py +1 -17
- DIRAC/Resources/Computing/SSHComputingElement.py +1 -18
- DIRAC/Resources/Computing/SingularityComputingElement.py +19 -5
- DIRAC/Resources/Computing/test/Test_HTCondorCEComputingElement.py +67 -49
- DIRAC/Resources/Computing/test/Test_PoolComputingElement.py +2 -1
- DIRAC/Resources/IdProvider/CheckInIdProvider.py +13 -0
- DIRAC/Resources/IdProvider/IdProviderFactory.py +11 -3
- DIRAC/Resources/MessageQueue/StompMQConnector.py +1 -1
- DIRAC/Resources/Storage/GFAL2_StorageBase.py +24 -15
- DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingHTTPJson.py +1 -3
- DIRAC/Resources/Storage/StorageBase.py +4 -2
- DIRAC/Resources/Storage/StorageElement.py +6 -7
- DIRAC/StorageManagementSystem/DB/StorageManagementDB.sql +2 -2
- DIRAC/TransformationSystem/Agent/TaskManagerAgentBase.py +10 -16
- DIRAC/TransformationSystem/Agent/TransformationAgent.py +22 -1
- DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py +16 -16
- DIRAC/TransformationSystem/Client/TaskManager.py +2 -4
- DIRAC/TransformationSystem/Client/Transformation.py +6 -7
- DIRAC/TransformationSystem/Client/TransformationClient.py +21 -11
- DIRAC/TransformationSystem/Client/Utilities.py +9 -0
- DIRAC/TransformationSystem/DB/TransformationDB.py +11 -14
- DIRAC/TransformationSystem/DB/TransformationDB.sql +9 -9
- DIRAC/TransformationSystem/Service/TransformationManagerHandler.py +0 -333
- DIRAC/TransformationSystem/Utilities/ReplicationCLIParameters.py +3 -3
- DIRAC/TransformationSystem/Utilities/TransformationInfo.py +7 -5
- DIRAC/TransformationSystem/scripts/dirac_production_runjoblocal.py +2 -4
- DIRAC/TransformationSystem/test/Test_TransformationInfo.py +22 -15
- DIRAC/TransformationSystem/test/Test_replicationTransformation.py +5 -6
- DIRAC/Workflow/Modules/test/Test_Modules.py +5 -0
- DIRAC/WorkloadManagementSystem/Agent/JobAgent.py +38 -26
- DIRAC/WorkloadManagementSystem/Agent/JobCleaningAgent.py +12 -8
- DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py +4 -3
- DIRAC/WorkloadManagementSystem/Agent/PushJobAgent.py +13 -13
- DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py +18 -14
- DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py +18 -51
- DIRAC/WorkloadManagementSystem/Agent/StatesAccountingAgent.py +41 -1
- DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobAgent.py +45 -4
- DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobCleaningAgent.py +7 -9
- DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_PushJobAgent.py +1 -0
- DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py +9 -2
- DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_StalledJobAgent.py +4 -5
- DIRAC/WorkloadManagementSystem/Client/DownloadInputData.py +9 -9
- DIRAC/WorkloadManagementSystem/Client/InputDataResolution.py +6 -6
- DIRAC/WorkloadManagementSystem/Client/JobMonitoringClient.py +10 -11
- DIRAC/WorkloadManagementSystem/Client/JobReport.py +1 -1
- DIRAC/WorkloadManagementSystem/Client/JobState/CachedJobState.py +3 -0
- DIRAC/WorkloadManagementSystem/Client/JobState/JobManifest.py +32 -261
- DIRAC/WorkloadManagementSystem/Client/JobState/JobState.py +6 -0
- DIRAC/WorkloadManagementSystem/Client/JobStateUpdateClient.py +3 -0
- DIRAC/WorkloadManagementSystem/Client/JobStatus.py +8 -152
- DIRAC/WorkloadManagementSystem/Client/PoolXMLSlice.py +12 -19
- DIRAC/WorkloadManagementSystem/Client/SandboxStoreClient.py +25 -38
- DIRAC/WorkloadManagementSystem/Client/WMSClient.py +2 -3
- DIRAC/WorkloadManagementSystem/Client/test/Test_Client_DownloadInputData.py +29 -0
- DIRAC/WorkloadManagementSystem/ConfigTemplate.cfg +4 -8
- DIRAC/WorkloadManagementSystem/DB/JobDB.py +89 -132
- DIRAC/WorkloadManagementSystem/DB/JobDB.sql +8 -8
- DIRAC/WorkloadManagementSystem/DB/JobDBUtils.py +18 -147
- DIRAC/WorkloadManagementSystem/DB/JobLoggingDB.py +19 -6
- DIRAC/WorkloadManagementSystem/DB/JobParametersDB.py +9 -9
- DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.py +16 -5
- DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.sql +3 -3
- DIRAC/WorkloadManagementSystem/DB/SandboxMetadataDB.py +44 -82
- DIRAC/WorkloadManagementSystem/DB/StatusUtils.py +125 -0
- DIRAC/WorkloadManagementSystem/DB/tests/Test_JobDB.py +1 -1
- DIRAC/WorkloadManagementSystem/DB/tests/Test_StatusUtils.py +28 -0
- DIRAC/WorkloadManagementSystem/Executor/JobSanity.py +5 -4
- DIRAC/WorkloadManagementSystem/Executor/JobScheduling.py +4 -0
- DIRAC/WorkloadManagementSystem/FutureClient/JobStateUpdateClient.py +75 -33
- DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py +22 -11
- DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapperTemplate.py +9 -10
- DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py +60 -10
- DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapperTemplate.py +4 -0
- DIRAC/WorkloadManagementSystem/Service/JobManagerHandler.py +33 -154
- DIRAC/WorkloadManagementSystem/Service/JobMonitoringHandler.py +5 -323
- DIRAC/WorkloadManagementSystem/Service/JobStateUpdateHandler.py +0 -16
- DIRAC/WorkloadManagementSystem/Service/PilotManagerHandler.py +6 -103
- DIRAC/WorkloadManagementSystem/Service/SandboxStoreHandler.py +7 -53
- DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py +16 -79
- DIRAC/WorkloadManagementSystem/Service/WMSUtilities.py +4 -18
- DIRAC/WorkloadManagementSystem/Utilities/JobModel.py +28 -209
- DIRAC/WorkloadManagementSystem/Utilities/JobParameters.py +65 -3
- DIRAC/WorkloadManagementSystem/Utilities/JobStatusUtility.py +2 -64
- DIRAC/WorkloadManagementSystem/Utilities/ParametricJob.py +7 -171
- DIRAC/WorkloadManagementSystem/Utilities/PilotCStoJSONSynchronizer.py +73 -7
- DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py +41 -11
- DIRAC/WorkloadManagementSystem/Utilities/RemoteRunner.py +16 -0
- DIRAC/WorkloadManagementSystem/Utilities/Utils.py +36 -1
- DIRAC/WorkloadManagementSystem/Utilities/jobAdministration.py +15 -0
- DIRAC/WorkloadManagementSystem/Utilities/test/Test_JobModel.py +1 -15
- DIRAC/WorkloadManagementSystem/Utilities/test/Test_ParametricJob.py +45 -128
- DIRAC/WorkloadManagementSystem/Utilities/test/Test_PilotWrapper.py +16 -0
- DIRAC/WorkloadManagementSystem/scripts/dirac_jobexec.py +7 -2
- DIRAC/WorkloadManagementSystem/scripts/dirac_wms_pilot_job_info.py +1 -1
- DIRAC/__init__.py +62 -60
- DIRAC/tests/Utilities/testJobDefinitions.py +22 -28
- {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/METADATA +8 -5
- {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/RECORD +229 -228
- {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/WHEEL +1 -1
- {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/entry_points.txt +0 -3
- DIRAC/Core/Utilities/test/Test_List.py +0 -150
- DIRAC/Core/Utilities/test/Test_Time.py +0 -88
- DIRAC/Resources/Computing/PilotBundle.py +0 -70
- DIRAC/TransformationSystem/scripts/dirac_transformation_archive.py +0 -30
- DIRAC/TransformationSystem/scripts/dirac_transformation_clean.py +0 -30
- DIRAC/TransformationSystem/scripts/dirac_transformation_remove_output.py +0 -30
- DIRAC/WorkloadManagementSystem/Utilities/test/Test_JobManager.py +0 -58
- {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info/licenses}/LICENSE +0 -0
- {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/top_level.txt +0 -0
|
@@ -333,13 +333,13 @@ class AuthServer(_AuthorizationServer):
|
|
|
333
333
|
"""Parse request. Rewrite authlib method."""
|
|
334
334
|
return self.create_oauth2_request(request, JsonRequest, True)
|
|
335
335
|
|
|
336
|
-
def validate_requested_scope(self, scope
|
|
336
|
+
def validate_requested_scope(self, scope):
|
|
337
337
|
"""See :func:`authlib.oauth2.rfc6749.authorization_server.validate_requested_scope`"""
|
|
338
338
|
# We also consider parametric scope containing ":" charter
|
|
339
339
|
extended_scope = list_to_scope(
|
|
340
340
|
[re.sub(r":.*$", ":", s) for s in scope_to_list((scope or "").replace("+", " "))]
|
|
341
341
|
)
|
|
342
|
-
super().validate_requested_scope(extended_scope
|
|
342
|
+
super().validate_requested_scope(extended_scope)
|
|
343
343
|
|
|
344
344
|
def handle_response(self, status_code=None, payload=None, headers=None, newSession=None, delSession=None):
|
|
345
345
|
"""Handle response
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Script to update pilot version in CS
|
|
4
4
|
"""
|
|
5
|
+
from packaging.version import Version
|
|
6
|
+
|
|
5
7
|
import DIRAC
|
|
6
8
|
from DIRAC.Core.Base.Script import Script
|
|
7
9
|
|
|
@@ -25,8 +27,9 @@ def main():
|
|
|
25
27
|
if switch[0] == "v" or switch[0] == "vo":
|
|
26
28
|
vo = switch[1]
|
|
27
29
|
|
|
28
|
-
from DIRAC import S_OK
|
|
29
|
-
from DIRAC import
|
|
30
|
+
from DIRAC import S_OK
|
|
31
|
+
from DIRAC import gLogger
|
|
32
|
+
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
|
30
33
|
from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI
|
|
31
34
|
|
|
32
35
|
def updatePilot(version, vo):
|
|
@@ -38,21 +41,25 @@ def main():
|
|
|
38
41
|
:param version: version vArBpC of pilot you want to use
|
|
39
42
|
:param vo: Location of pilot version in CS /Operations/<vo>/Pilot/Version
|
|
40
43
|
"""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
pilotVersion = sorted(Operations(vo=vo).getValue("Pilot/Version", []), key=lambda x: Version(x), reverse=True)
|
|
45
|
+
if version in pilotVersion:
|
|
46
|
+
gLogger.warn(f"Version {version} already set in CS")
|
|
47
|
+
elif pilotVersion:
|
|
48
|
+
pilotVersion = [version, pilotVersion[0]]
|
|
49
|
+
else:
|
|
50
|
+
gLogger.warn("No pilot version set in CS")
|
|
51
|
+
pilotVersion = [version]
|
|
48
52
|
api = CSAPI()
|
|
49
|
-
|
|
53
|
+
if vo:
|
|
54
|
+
api.setOption(f"Operations/{vo}/Pilot/Version", ", ".join(pilotVersion))
|
|
55
|
+
else:
|
|
56
|
+
api.setOption("Operations/Defaults/Pilot/Version", ", ".join(pilotVersion))
|
|
50
57
|
result = api.commit()
|
|
51
58
|
if not result["OK"]:
|
|
52
59
|
gLogger.fatal("Could not commit new version of pilot!")
|
|
53
60
|
return result
|
|
54
61
|
|
|
55
|
-
newVersion =
|
|
62
|
+
newVersion = Operations(vo=vo).getValue("Pilot/Version")
|
|
56
63
|
return S_OK(f"New version of pilot set to {newVersion}")
|
|
57
64
|
|
|
58
65
|
result = updatePilot(version, vo)
|
|
@@ -38,8 +38,8 @@ Script.disableCS()
|
|
|
38
38
|
from DIRAC.ConfigurationSystem.Client.Helpers.Registry import (
|
|
39
39
|
findDefaultGroupForDN,
|
|
40
40
|
getGroupOption,
|
|
41
|
+
getVOForGroup,
|
|
41
42
|
getVOMSAttributeForGroup,
|
|
42
|
-
getVOMSVOForGroup,
|
|
43
43
|
)
|
|
44
44
|
from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager
|
|
45
45
|
from DIRAC.FrameworkSystem.private.authorization.utils.Tokens import (
|
|
@@ -285,7 +285,7 @@ class Params:
|
|
|
285
285
|
if not (vomsAttr := getVOMSAttributeForGroup(self.group)):
|
|
286
286
|
print(HTML(f"<yellow>No VOMS attribute foud for {self.group}</yellow>"))
|
|
287
287
|
else:
|
|
288
|
-
vo =
|
|
288
|
+
vo = getVOForGroup(self.group)
|
|
289
289
|
if not (result := VOMS().setVOMSAttributes(self.outputFile, attribute=vomsAttr, vo=vo))["OK"]:
|
|
290
290
|
return S_ERROR(f"Failed adding VOMS attribute: {result['Message']}")
|
|
291
291
|
chain = result["Value"]
|
|
@@ -6,21 +6,20 @@ Example:
|
|
|
6
6
|
$ dirac-proxy-init -g dirac_user
|
|
7
7
|
Enter Certificate password: **************
|
|
8
8
|
"""
|
|
9
|
+
import datetime
|
|
10
|
+
import glob
|
|
9
11
|
import os
|
|
10
12
|
import sys
|
|
11
|
-
import glob
|
|
12
13
|
import time
|
|
13
|
-
import datetime
|
|
14
14
|
|
|
15
15
|
import DIRAC
|
|
16
|
-
|
|
17
|
-
from DIRAC import
|
|
16
|
+
from DIRAC import S_ERROR, S_OK, gLogger
|
|
17
|
+
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
|
|
18
18
|
from DIRAC.Core.Base.Script import Script
|
|
19
|
-
from DIRAC.
|
|
20
|
-
from DIRAC.Core.Security import X509Chain, ProxyInfo, VOMS
|
|
19
|
+
from DIRAC.Core.Security import VOMS, ProxyInfo, X509Chain
|
|
21
20
|
from DIRAC.Core.Security.DiracX import addTokenToPEM
|
|
22
21
|
from DIRAC.Core.Security.Locations import getCAsLocation, getDefaultProxyLocation
|
|
23
|
-
from DIRAC.
|
|
22
|
+
from DIRAC.FrameworkSystem.Client import ProxyGeneration, ProxyUpload
|
|
24
23
|
from DIRAC.FrameworkSystem.Client.BundleDeliveryClient import BundleDeliveryClient
|
|
25
24
|
|
|
26
25
|
|
|
@@ -97,7 +96,7 @@ class ProxyInit:
|
|
|
97
96
|
)
|
|
98
97
|
|
|
99
98
|
resultVomsAttributes = VOMS.VOMS().setVOMSAttributes(
|
|
100
|
-
self.__proxyGenerated, attribute=vomsAttr, vo=Registry.
|
|
99
|
+
self.__proxyGenerated, attribute=vomsAttr, vo=Registry.getVOForGroup(self.__piParams.diracGroup)
|
|
101
100
|
)
|
|
102
101
|
if not resultVomsAttributes["OK"]:
|
|
103
102
|
return S_ERROR(
|
DIRAC/Interfaces/API/Dirac.py
CHANGED
|
@@ -46,8 +46,7 @@ from DIRAC.WorkloadManagementSystem.Client import JobStatus
|
|
|
46
46
|
from DIRAC.WorkloadManagementSystem.Client.JobMonitoringClient import JobMonitoringClient
|
|
47
47
|
from DIRAC.WorkloadManagementSystem.Client.SandboxStoreClient import SandboxStoreClient
|
|
48
48
|
from DIRAC.WorkloadManagementSystem.Client.WMSClient import WMSClient
|
|
49
|
-
|
|
50
|
-
COMPONENT_NAME = "DiracAPI"
|
|
49
|
+
from DIRAC.WorkloadManagementSystem.Utilities.jobAdministration import _filterJobStateTransition
|
|
51
50
|
|
|
52
51
|
|
|
53
52
|
def parseArguments(args):
|
|
@@ -423,6 +422,14 @@ class Dirac(API):
|
|
|
423
422
|
sandbox = [isFile.strip() for isFile in sandbox.split(",")]
|
|
424
423
|
for isFile in sandbox:
|
|
425
424
|
self.log.debug(f"Resolving Input Sandbox {isFile}")
|
|
425
|
+
# If the sandbox is already in the sandbox store, download it
|
|
426
|
+
if isFile.startswith("SB:"):
|
|
427
|
+
result = SandboxStoreClient(useCertificates=self.useCertificates).downloadSandbox(
|
|
428
|
+
isFile, destinationDir=os.getcwd()
|
|
429
|
+
)
|
|
430
|
+
if not result["OK"]:
|
|
431
|
+
return S_ERROR(f"Cannot download Input sandbox {isFile}: {result['Message']}")
|
|
432
|
+
continue
|
|
426
433
|
if isFile.lower().startswith("lfn:"): # isFile is an LFN
|
|
427
434
|
isFile = isFile[4:]
|
|
428
435
|
# Attempt to copy into job working directory, unless it is already there
|
|
@@ -1452,10 +1459,12 @@ class Dirac(API):
|
|
|
1452
1459
|
# Remove any job IDs that can't change to the Killed or Deleted states
|
|
1453
1460
|
filteredJobs = set()
|
|
1454
1461
|
for filterState in (JobStatus.KILLED, JobStatus.DELETED):
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1462
|
+
# get a dictionary of jobID:status
|
|
1463
|
+
res = JobMonitoringClient().getJobsStatus(jobIDs)
|
|
1464
|
+
if not res["OK"]:
|
|
1465
|
+
return res
|
|
1466
|
+
# then filter
|
|
1467
|
+
filteredJobs.update(_filterJobStateTransition(res["Value"], filterState))
|
|
1459
1468
|
|
|
1460
1469
|
return WMSClient(useCertificates=self.useCertificates).deleteJob(list(filteredJobs))
|
|
1461
1470
|
|
|
@@ -1482,11 +1491,12 @@ class Dirac(API):
|
|
|
1482
1491
|
return ret
|
|
1483
1492
|
jobIDs = ret["Value"]
|
|
1484
1493
|
|
|
1485
|
-
#
|
|
1486
|
-
|
|
1487
|
-
if not
|
|
1488
|
-
return
|
|
1489
|
-
|
|
1494
|
+
# get a dictionary of jobID:status
|
|
1495
|
+
res = JobMonitoringClient().getJobsStatus(jobIDs)
|
|
1496
|
+
if not res["OK"]:
|
|
1497
|
+
return res
|
|
1498
|
+
# then filter
|
|
1499
|
+
jobIDsToReschedule = _filterJobStateTransition(res["Value"], JobStatus.RESCHEDULED)
|
|
1490
1500
|
|
|
1491
1501
|
return WMSClient(useCertificates=self.useCertificates).rescheduleJob(jobIDsToReschedule)
|
|
1492
1502
|
|
|
@@ -1512,10 +1522,12 @@ class Dirac(API):
|
|
|
1512
1522
|
# Remove any job IDs that can't change to the Killed or Deleted states
|
|
1513
1523
|
filteredJobs = set()
|
|
1514
1524
|
for filterState in (JobStatus.KILLED, JobStatus.DELETED):
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1525
|
+
# get a dictionary of jobID:status
|
|
1526
|
+
res = JobMonitoringClient().getJobsStatus(jobIDs)
|
|
1527
|
+
if not res["OK"]:
|
|
1528
|
+
return res
|
|
1529
|
+
# then filter
|
|
1530
|
+
filteredJobs.update(_filterJobStateTransition(res["Value"], filterState))
|
|
1519
1531
|
|
|
1520
1532
|
return WMSClient(useCertificates=self.useCertificates).killJob(list(filteredJobs))
|
|
1521
1533
|
|
|
@@ -4,7 +4,9 @@ All administrative functionality is exposed through the DIRAC Admin API. Exampl
|
|
|
4
4
|
site banning and unbanning, WMS proxy uploading etc.
|
|
5
5
|
|
|
6
6
|
"""
|
|
7
|
+
|
|
7
8
|
import os
|
|
9
|
+
from datetime import datetime, timedelta
|
|
8
10
|
|
|
9
11
|
from DIRAC import S_ERROR, S_OK, gConfig, gLogger
|
|
10
12
|
from DIRAC.ConfigurationSystem.Client.CSAPI import CSAPI
|
|
@@ -19,14 +21,15 @@ from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus
|
|
|
19
21
|
from DIRAC.WorkloadManagementSystem.Client.JobManagerClient import JobManagerClient
|
|
20
22
|
from DIRAC.WorkloadManagementSystem.Client.PilotManagerClient import PilotManagerClient
|
|
21
23
|
from DIRAC.WorkloadManagementSystem.Client.WMSAdministratorClient import WMSAdministratorClient
|
|
24
|
+
from DIRAC.WorkloadManagementSystem.Service.WMSUtilities import (
|
|
25
|
+
killPilotsInQueues,
|
|
26
|
+
)
|
|
22
27
|
|
|
23
28
|
voName = ""
|
|
24
29
|
ret = getProxyInfo(disableVOMS=True)
|
|
25
30
|
if ret["OK"] and "group" in ret["Value"]:
|
|
26
31
|
voName = getVOForGroup(ret["Value"]["group"])
|
|
27
32
|
|
|
28
|
-
COMPONENT_NAME = "/Interfaces/API/DiracAdmin"
|
|
29
|
-
|
|
30
33
|
|
|
31
34
|
class DiracAdmin(API):
|
|
32
35
|
"""Administrative functionalities"""
|
|
@@ -38,11 +41,6 @@ class DiracAdmin(API):
|
|
|
38
41
|
|
|
39
42
|
self.csAPI = CSAPI()
|
|
40
43
|
|
|
41
|
-
self.dbg = False
|
|
42
|
-
if gConfig.getValue(self.section + "/LogLevel", "DEBUG") == "DEBUG":
|
|
43
|
-
self.dbg = True
|
|
44
|
-
|
|
45
|
-
self.scratchDir = gConfig.getValue(self.section + "/ScratchDir", "/tmp")
|
|
46
44
|
self.currentDir = os.getcwd()
|
|
47
45
|
self.sitestatus = SiteStatus()
|
|
48
46
|
|
|
@@ -154,7 +152,7 @@ class DiracAdmin(API):
|
|
|
154
152
|
return result
|
|
155
153
|
|
|
156
154
|
#############################################################################
|
|
157
|
-
def allowSite(self, site, comment, printOutput=False):
|
|
155
|
+
def allowSite(self, site, comment, printOutput=False, days=1):
|
|
158
156
|
"""Adds the site to the site mask. The site must be a valid DIRAC site name
|
|
159
157
|
|
|
160
158
|
Example usage:
|
|
@@ -178,7 +176,13 @@ class DiracAdmin(API):
|
|
|
178
176
|
gLogger.notice(f"Site {site} is already Active")
|
|
179
177
|
return S_OK(f"Site {site} is already Active")
|
|
180
178
|
|
|
181
|
-
|
|
179
|
+
tokenLifetime = int(days)
|
|
180
|
+
if tokenLifetime <= 0:
|
|
181
|
+
tokenExpiration = datetime.max
|
|
182
|
+
else:
|
|
183
|
+
tokenExpiration = datetime.utcnow().replace(microsecond=0) + timedelta(days=tokenLifetime)
|
|
184
|
+
|
|
185
|
+
if not (result := self.sitestatus.setSiteStatus(site, "Active", comment, expiry=tokenExpiration))["OK"]:
|
|
182
186
|
return result
|
|
183
187
|
|
|
184
188
|
if printOutput:
|
|
@@ -227,7 +231,7 @@ class DiracAdmin(API):
|
|
|
227
231
|
return S_OK()
|
|
228
232
|
|
|
229
233
|
#############################################################################
|
|
230
|
-
def banSite(self, site, comment, printOutput=False):
|
|
234
|
+
def banSite(self, site, comment, printOutput=False, days=1):
|
|
231
235
|
"""Removes the site from the site mask.
|
|
232
236
|
|
|
233
237
|
Example usage:
|
|
@@ -240,7 +244,6 @@ class DiracAdmin(API):
|
|
|
240
244
|
"""
|
|
241
245
|
if not (result := self._checkSiteIsValid(site))["OK"]:
|
|
242
246
|
return result
|
|
243
|
-
|
|
244
247
|
mask = self.getSiteMask(status="Banned")
|
|
245
248
|
if not mask["OK"]:
|
|
246
249
|
return mask
|
|
@@ -250,7 +253,12 @@ class DiracAdmin(API):
|
|
|
250
253
|
gLogger.notice(f"Site {site} is already Banned")
|
|
251
254
|
return S_OK(f"Site {site} is already Banned")
|
|
252
255
|
|
|
253
|
-
|
|
256
|
+
tokenLifetime = int(days)
|
|
257
|
+
if tokenLifetime <= 0:
|
|
258
|
+
tokenExpiration = datetime.max
|
|
259
|
+
else:
|
|
260
|
+
tokenExpiration = datetime.utcnow().replace(microsecond=0) + timedelta(days=tokenLifetime)
|
|
261
|
+
if not (result := self.sitestatus.setSiteStatus(site, "Banned", comment, expiry=tokenExpiration))["OK"]:
|
|
254
262
|
return result
|
|
255
263
|
|
|
256
264
|
if printOutput:
|
|
@@ -456,11 +464,31 @@ class DiracAdmin(API):
|
|
|
456
464
|
:param gridReference: Pilot Job Reference
|
|
457
465
|
:return: S_OK,S_ERROR
|
|
458
466
|
"""
|
|
459
|
-
if not isinstance(gridReference, str):
|
|
460
|
-
return self._errorReport("Expected string for pilot reference")
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
467
|
+
if not isinstance(gridReference, (str, list)):
|
|
468
|
+
return self._errorReport("Expected string or list of strings for pilot reference")
|
|
469
|
+
|
|
470
|
+
# Make a list if it is not yet
|
|
471
|
+
if isinstance(gridReference, str):
|
|
472
|
+
gridReference = [gridReference]
|
|
473
|
+
|
|
474
|
+
# Regroup pilots per site
|
|
475
|
+
pilotRefDict = {}
|
|
476
|
+
for pilotReference in gridReference:
|
|
477
|
+
result = PilotManagerClient().getPilotInfo(pilotReference)
|
|
478
|
+
if not result["OK"] or not result["Value"]:
|
|
479
|
+
return S_ERROR(f"Failed to get info for pilot {pilotReference}")
|
|
480
|
+
|
|
481
|
+
pilotDict = result["Value"][pilotReference]
|
|
482
|
+
queue = "@@@".join(
|
|
483
|
+
[pilotDict["VO"], pilotDict["GridSite"], pilotDict["DestinationSite"], pilotDict["Queue"]]
|
|
484
|
+
)
|
|
485
|
+
gridType = pilotDict["GridType"]
|
|
486
|
+
pilotRefDict.setdefault(queue, {})
|
|
487
|
+
pilotRefDict[queue].setdefault("PilotList", [])
|
|
488
|
+
pilotRefDict[queue]["PilotList"].append(pilotReference)
|
|
489
|
+
pilotRefDict[queue]["GridType"] = gridType
|
|
490
|
+
|
|
491
|
+
return killPilotsInQueues(pilotRefDict)
|
|
464
492
|
|
|
465
493
|
#############################################################################
|
|
466
494
|
def getPilotLoggingInfo(self, gridReference):
|
DIRAC/Interfaces/API/Job.py
CHANGED
|
@@ -22,30 +22,25 @@
|
|
|
22
22
|
|
|
23
23
|
Note that several executables can be provided and wil be executed sequentially.
|
|
24
24
|
"""
|
|
25
|
-
import re
|
|
26
25
|
import os
|
|
26
|
+
import re
|
|
27
27
|
import shlex
|
|
28
|
-
|
|
29
28
|
from io import StringIO
|
|
30
29
|
from urllib.parse import quote
|
|
31
30
|
|
|
32
31
|
from DIRAC import S_OK, gLogger
|
|
32
|
+
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
|
33
|
+
from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getVOForGroup
|
|
34
|
+
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping, getDIRACPlatforms
|
|
33
35
|
from DIRAC.Core.Base.API import API
|
|
34
36
|
from DIRAC.Core.Security.ProxyInfo import getProxyInfo
|
|
35
|
-
from DIRAC.Core.Workflow.Parameter import Parameter
|
|
36
|
-
from DIRAC.Core.Workflow.Workflow import Workflow
|
|
37
37
|
from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd
|
|
38
|
-
from DIRAC.Core.Utilities.Subprocess import systemCall
|
|
39
38
|
from DIRAC.Core.Utilities.List import uniqueElements
|
|
40
|
-
from DIRAC.Core.Utilities.
|
|
41
|
-
from DIRAC.
|
|
42
|
-
from DIRAC.
|
|
43
|
-
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping, getDIRACPlatforms
|
|
39
|
+
from DIRAC.Core.Utilities.Subprocess import systemCall
|
|
40
|
+
from DIRAC.Core.Workflow.Parameter import Parameter
|
|
41
|
+
from DIRAC.Core.Workflow.Workflow import Workflow
|
|
44
42
|
from DIRAC.Interfaces.API.Dirac import Dirac
|
|
45
|
-
from DIRAC.Workflow.Utilities.Utils import
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
COMPONENT_NAME = "/Interfaces/API/Job"
|
|
43
|
+
from DIRAC.Workflow.Utilities.Utils import addStepToWorkflow, getStepDefinition
|
|
49
44
|
|
|
50
45
|
|
|
51
46
|
class BadJobParameterError(ValueError):
|
|
@@ -1110,6 +1105,7 @@ class Job(API):
|
|
|
1110
1105
|
uniqueInputSandbox = uniqueElements(finalInputSandbox.split(";"))
|
|
1111
1106
|
paramsDict["InputSandbox"]["value"] = ";".join(uniqueInputSandbox)
|
|
1112
1107
|
self.log.verbose(f"Final unique Input Sandbox {';'.join(uniqueInputSandbox)}")
|
|
1108
|
+
paramsDict["InputSandbox"]["type"] = "JDL"
|
|
1113
1109
|
else:
|
|
1114
1110
|
paramsDict["InputSandbox"] = {}
|
|
1115
1111
|
paramsDict["InputSandbox"]["value"] = extraFiles
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
########################################################################
|
|
3
|
-
# File : dirac-admin-allow-site
|
|
4
|
-
# Author : Stuart Paterson
|
|
5
|
-
########################################################################
|
|
6
2
|
"""
|
|
7
3
|
Add Site to Active mask for current Setup
|
|
8
4
|
|
|
@@ -17,13 +13,16 @@ from DIRAC.Core.Base.Script import Script
|
|
|
17
13
|
@Script()
|
|
18
14
|
def main():
|
|
19
15
|
Script.registerSwitch("E:", "email=", "Boolean True/False (True by default)")
|
|
16
|
+
Script.registerSwitch(
|
|
17
|
+
"", "days=", "Number of days the token is valid for. Default is 1 day. 0 or less days denotes forever."
|
|
18
|
+
)
|
|
20
19
|
# Registering arguments will automatically add their description to the help menu
|
|
21
20
|
Script.registerArgument("Site: Name of the Site")
|
|
22
21
|
Script.registerArgument("Comment: Reason of the action")
|
|
23
22
|
Script.parseCommandLine(ignoreErrors=True)
|
|
24
23
|
|
|
25
24
|
from DIRAC import exit as DIRACExit
|
|
26
|
-
from DIRAC import gLogger
|
|
25
|
+
from DIRAC import gConfig, gLogger
|
|
27
26
|
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
|
28
27
|
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
|
|
29
28
|
|
|
@@ -36,33 +35,28 @@ def main():
|
|
|
36
35
|
Script.showHelp()
|
|
37
36
|
|
|
38
37
|
email = True
|
|
38
|
+
days = 1
|
|
39
39
|
for switch in Script.getUnprocessedSwitches():
|
|
40
40
|
if switch[0] == "email":
|
|
41
41
|
email = getBoolean(switch[1])
|
|
42
|
+
if switch[0] == "days":
|
|
43
|
+
days = int(switch[1])
|
|
42
44
|
|
|
43
45
|
diracAdmin = DiracAdmin()
|
|
44
46
|
exitCode = 0
|
|
45
47
|
errorList = []
|
|
46
48
|
|
|
47
|
-
# result = promptUser(
|
|
48
|
-
# 'All the elements that are associated with this site will be active, '
|
|
49
|
-
# 'are you sure about this action?'
|
|
50
|
-
# )
|
|
51
|
-
# if not result['OK'] or result['Value'] is 'n':
|
|
52
|
-
# print 'Script stopped'
|
|
53
|
-
# DIRACExit( 0 )
|
|
54
|
-
|
|
55
49
|
# parseCommandLine show help when mandatory arguments are not specified or incorrect argument
|
|
56
50
|
site, comment = Script.getPositionalArgs(group=True)
|
|
57
|
-
result = diracAdmin.allowSite(site, comment, printOutput=True)
|
|
51
|
+
result = diracAdmin.allowSite(site, comment, printOutput=True, days=days)
|
|
58
52
|
if not result["OK"]:
|
|
59
53
|
errorList.append((site, result["Message"]))
|
|
60
54
|
exitCode = 2
|
|
61
55
|
else:
|
|
62
|
-
if email:
|
|
56
|
+
if email and not gConfig.getValue("/DIRAC/Security/UseServerCertificate"):
|
|
63
57
|
userName = diracAdmin._getCurrentUser()
|
|
64
58
|
if not userName["OK"]:
|
|
65
|
-
|
|
59
|
+
gLogger.error("Could not obtain current username from proxy")
|
|
66
60
|
exitCode = 2
|
|
67
61
|
DIRACExit(exitCode)
|
|
68
62
|
userName = userName["Value"]
|
|
@@ -81,10 +75,10 @@ def main():
|
|
|
81
75
|
fromAddress = Operations().getValue("ResourceStatus/Config/FromAddress", "")
|
|
82
76
|
result = diracAdmin.sendMail(address, subject, body, fromAddress=fromAddress)
|
|
83
77
|
else:
|
|
84
|
-
|
|
78
|
+
gLogger.warn("Automatic email disabled by flag.")
|
|
85
79
|
|
|
86
80
|
for error in errorList:
|
|
87
|
-
|
|
81
|
+
gLogger.error(error)
|
|
88
82
|
|
|
89
83
|
DIRACExit(exitCode)
|
|
90
84
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
########################################################################
|
|
3
|
-
# File : dirac-admin-ban-site
|
|
4
|
-
# Author : Stuart Paterson
|
|
5
|
-
########################################################################
|
|
6
2
|
"""
|
|
7
3
|
Remove Site from Active mask for current Setup
|
|
8
4
|
|
|
@@ -17,13 +13,16 @@ from DIRAC.Core.Base.Script import Script
|
|
|
17
13
|
@Script()
|
|
18
14
|
def main():
|
|
19
15
|
Script.registerSwitch("E:", "email=", "Boolean True/False (True by default)")
|
|
16
|
+
Script.registerSwitch(
|
|
17
|
+
"", "days=", "Number of days the token is valid for. Default is 1 day. 0 or less days denotes forever."
|
|
18
|
+
)
|
|
20
19
|
# Registering arguments will automatically add their description to the help menu
|
|
21
20
|
Script.registerArgument("Site: Name of the Site")
|
|
22
21
|
Script.registerArgument("Comment: Reason of the action")
|
|
23
22
|
Script.parseCommandLine(ignoreErrors=True)
|
|
24
23
|
|
|
25
24
|
from DIRAC import exit as DIRACExit
|
|
26
|
-
from DIRAC import gLogger
|
|
25
|
+
from DIRAC import gConfig, gLogger
|
|
27
26
|
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
|
28
27
|
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
|
|
29
28
|
|
|
@@ -36,9 +35,12 @@ def main():
|
|
|
36
35
|
Script.showHelp()
|
|
37
36
|
|
|
38
37
|
email = True
|
|
38
|
+
days = 1
|
|
39
39
|
for switch in Script.getUnprocessedSwitches():
|
|
40
40
|
if switch[0] == "email":
|
|
41
41
|
email = getBoolean(switch[1])
|
|
42
|
+
if switch[0] == "days":
|
|
43
|
+
days = int(switch[1])
|
|
42
44
|
|
|
43
45
|
diracAdmin = DiracAdmin()
|
|
44
46
|
exitCode = 0
|
|
@@ -54,15 +56,15 @@ def main():
|
|
|
54
56
|
|
|
55
57
|
# parseCommandLine show help when mandatory arguments are not specified or incorrect argument
|
|
56
58
|
site, comment = Script.getPositionalArgs(group=True)
|
|
57
|
-
result = diracAdmin.banSite(site, comment, printOutput=True)
|
|
59
|
+
result = diracAdmin.banSite(site, comment, printOutput=True, days=days)
|
|
58
60
|
if not result["OK"]:
|
|
59
61
|
errorList.append((site, result["Message"]))
|
|
60
62
|
exitCode = 2
|
|
61
63
|
else:
|
|
62
|
-
if email:
|
|
64
|
+
if email and not gConfig.getValue("/DIRAC/Security/UseServerCertificate"):
|
|
63
65
|
userName = diracAdmin._getCurrentUser()
|
|
64
66
|
if not userName["OK"]:
|
|
65
|
-
|
|
67
|
+
gLogger.error("Could not obtain current username from proxy")
|
|
66
68
|
exitCode = 2
|
|
67
69
|
DIRACExit(exitCode)
|
|
68
70
|
userName = userName["Value"]
|
|
@@ -82,10 +84,10 @@ def main():
|
|
|
82
84
|
fromAddress = Operations().getValue("ResourceStatus/Config/FromAddress", "")
|
|
83
85
|
result = diracAdmin.sendMail(address, subject, body, fromAddress=fromAddress)
|
|
84
86
|
else:
|
|
85
|
-
|
|
87
|
+
gLogger.warn("Automatic email disabled by flag.")
|
|
86
88
|
|
|
87
89
|
for error in errorList:
|
|
88
|
-
|
|
90
|
+
gLogger.error(error)
|
|
89
91
|
|
|
90
92
|
DIRACExit(exitCode)
|
|
91
93
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
########################################################################
|
|
3
|
-
# File : dirac-admin-get-site-mask
|
|
4
|
-
# Author : Stuart Paterson
|
|
5
|
-
########################################################################
|
|
6
2
|
"""
|
|
7
3
|
Get the list of sites enabled in the mask for job submission
|
|
8
4
|
|
|
@@ -25,17 +21,12 @@ def main():
|
|
|
25
21
|
from DIRAC import exit as DIRACExit, gLogger
|
|
26
22
|
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
gLogger.setLevel("ALWAYS")
|
|
31
|
-
|
|
32
|
-
result = diracAdmin.getSiteMask(printOutput=True, status="Active")
|
|
33
|
-
if result["OK"]:
|
|
34
|
-
DIRACExit(0)
|
|
35
|
-
else:
|
|
36
|
-
print(result["Message"])
|
|
24
|
+
if not (result := DiracAdmin().getSiteMask(printOutput=True, status="Active"))["OK"]:
|
|
25
|
+
gLogger.error(result["Message"])
|
|
37
26
|
DIRACExit(2)
|
|
38
27
|
|
|
28
|
+
DIRACExit(0)
|
|
29
|
+
|
|
39
30
|
|
|
40
31
|
if __name__ == "__main__":
|
|
41
32
|
main()
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
########################################################################
|
|
3
|
-
# File : dirac-admin-reset-job
|
|
4
|
-
# Author : Stuart Paterson
|
|
5
|
-
########################################################################
|
|
6
2
|
"""
|
|
7
3
|
Reset a job or list of jobs in the WMS
|
|
8
4
|
|
|
@@ -20,6 +16,7 @@ def main():
|
|
|
20
16
|
Script.registerArgument(["JobID: DIRAC Job IDs"])
|
|
21
17
|
_, args = Script.parseCommandLine(ignoreErrors=True)
|
|
22
18
|
|
|
19
|
+
from DIRAC import gLogger
|
|
23
20
|
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
|
|
24
21
|
|
|
25
22
|
diracAdmin = DiracAdmin()
|
|
@@ -36,13 +33,13 @@ def main():
|
|
|
36
33
|
|
|
37
34
|
result = diracAdmin.resetJob(job)
|
|
38
35
|
if result["OK"]:
|
|
39
|
-
|
|
36
|
+
gLogger.notice(f"Reset Job {job}")
|
|
40
37
|
else:
|
|
41
38
|
errorList.append((job, result["Message"]))
|
|
42
39
|
exitCode = 2
|
|
43
40
|
|
|
44
41
|
for error in errorList:
|
|
45
|
-
|
|
42
|
+
gLogger.error(error)
|
|
46
43
|
|
|
47
44
|
DIRAC.exit(exitCode)
|
|
48
45
|
|
|
@@ -30,6 +30,8 @@ class WMSHistory(BaseType):
|
|
|
30
30
|
"MinorStatus",
|
|
31
31
|
"ApplicationStatus",
|
|
32
32
|
"JobSplitType",
|
|
33
|
+
"Tier",
|
|
34
|
+
"Type",
|
|
33
35
|
]
|
|
34
36
|
|
|
35
37
|
self.monitoringFields = ["Jobs", "Reschedules"]
|
|
@@ -46,6 +48,8 @@ class WMSHistory(BaseType):
|
|
|
46
48
|
"User": {"type": "keyword"},
|
|
47
49
|
"JobGroup": {"type": "keyword"},
|
|
48
50
|
"UserGroup": {"type": "keyword"},
|
|
51
|
+
"Tier": {"type": "keyword"},
|
|
52
|
+
"Type": {"type": "keyword"},
|
|
49
53
|
}
|
|
50
54
|
)
|
|
51
55
|
# {'timestamp': {'type': 'date'}} will be added for all monitoring types
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
""" Module that contains client access to the WebApp handler.
|
|
2
|
+
"""
|
|
3
|
+
|
|
4
|
+
from DIRAC.Core.Base.Client import Client, createClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@createClient("Monitoring/WebApp")
|
|
8
|
+
class WebAppClient(Client):
|
|
9
|
+
"""WebAppClient sets url for the WebAppHandler."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, url=None, **kwargs):
|
|
12
|
+
"""
|
|
13
|
+
Sets URL for WebApp handler
|
|
14
|
+
|
|
15
|
+
:param self: self reference
|
|
16
|
+
:param url: url of the WebAppHandler
|
|
17
|
+
:param kwargs: forwarded to the Base Client class
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
super().__init__(**kwargs)
|
|
21
|
+
|
|
22
|
+
if not url:
|
|
23
|
+
self.serverURL = "Monitoring/WebApp"
|
|
24
|
+
|
|
25
|
+
else:
|
|
26
|
+
self.serverURL = url
|