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.
Files changed (236) hide show
  1. DIRAC/AccountingSystem/Client/AccountingCLI.py +0 -140
  2. DIRAC/AccountingSystem/Client/DataStoreClient.py +0 -13
  3. DIRAC/AccountingSystem/Client/Types/BaseAccountingType.py +0 -7
  4. DIRAC/AccountingSystem/ConfigTemplate.cfg +0 -5
  5. DIRAC/AccountingSystem/Service/DataStoreHandler.py +0 -72
  6. DIRAC/ConfigurationSystem/Client/Helpers/CSGlobals.py +0 -9
  7. DIRAC/ConfigurationSystem/Client/Helpers/Registry.py +38 -26
  8. DIRAC/ConfigurationSystem/Client/Helpers/Resources.py +11 -43
  9. DIRAC/ConfigurationSystem/Client/Helpers/test/Test_Helpers.py +0 -16
  10. DIRAC/ConfigurationSystem/Client/LocalConfiguration.py +14 -8
  11. DIRAC/ConfigurationSystem/Client/PathFinder.py +47 -8
  12. DIRAC/ConfigurationSystem/Client/SyncPlugins/CERNLDAPSyncPlugin.py +4 -1
  13. DIRAC/ConfigurationSystem/Client/VOMS2CSSynchronizer.py +32 -19
  14. DIRAC/ConfigurationSystem/Client/test/Test_PathFinder.py +41 -1
  15. DIRAC/ConfigurationSystem/private/RefresherBase.py +4 -2
  16. DIRAC/Core/Base/API.py +4 -7
  17. DIRAC/Core/Base/SQLAlchemyDB.py +1 -0
  18. DIRAC/Core/DISET/ServiceReactor.py +11 -3
  19. DIRAC/Core/DISET/private/BaseClient.py +1 -2
  20. DIRAC/Core/DISET/private/Transports/M2SSLTransport.py +9 -7
  21. DIRAC/Core/DISET/private/Transports/SSL/M2Utils.py +3 -1
  22. DIRAC/Core/LCG/GOCDBClient.py +5 -7
  23. DIRAC/Core/Security/DiracX.py +31 -17
  24. DIRAC/Core/Security/IAMService.py +5 -10
  25. DIRAC/Core/Security/Locations.py +27 -18
  26. DIRAC/Core/Security/ProxyInfo.py +9 -5
  27. DIRAC/Core/Security/VOMSService.py +2 -4
  28. DIRAC/Core/Security/m2crypto/X509Certificate.py +4 -6
  29. DIRAC/Core/Security/m2crypto/asn1_utils.py +17 -5
  30. DIRAC/Core/Security/test/test_diracx_token_from_pem.py +161 -0
  31. DIRAC/Core/Tornado/Client/ClientSelector.py +4 -1
  32. DIRAC/Core/Tornado/Server/TornadoService.py +1 -1
  33. DIRAC/Core/Utilities/CGroups2.py +328 -0
  34. DIRAC/Core/Utilities/ClassAd/ClassAdLight.py +4 -290
  35. DIRAC/Core/Utilities/DErrno.py +5 -309
  36. DIRAC/Core/Utilities/Extensions.py +10 -1
  37. DIRAC/Core/Utilities/File.py +1 -1
  38. DIRAC/Core/Utilities/Graphs/GraphData.py +1 -1
  39. DIRAC/Core/Utilities/Graphs/GraphUtilities.py +6 -1
  40. DIRAC/Core/Utilities/JDL.py +1 -195
  41. DIRAC/Core/Utilities/List.py +1 -124
  42. DIRAC/Core/Utilities/MySQL.py +103 -99
  43. DIRAC/Core/Utilities/Os.py +32 -1
  44. DIRAC/Core/Utilities/Platform.py +2 -107
  45. DIRAC/Core/Utilities/Proxy.py +0 -4
  46. DIRAC/Core/Utilities/ReturnValues.py +7 -252
  47. DIRAC/Core/Utilities/StateMachine.py +12 -178
  48. DIRAC/Core/Utilities/Subprocess.py +35 -14
  49. DIRAC/Core/Utilities/TimeUtilities.py +10 -253
  50. DIRAC/Core/Utilities/test/Test_JDL.py +0 -3
  51. DIRAC/Core/Utilities/test/Test_Profiler.py +20 -20
  52. DIRAC/Core/scripts/dirac_agent.py +1 -1
  53. DIRAC/Core/scripts/dirac_apptainer_exec.py +72 -46
  54. DIRAC/Core/scripts/dirac_configure.py +1 -3
  55. DIRAC/Core/scripts/dirac_install_db.py +24 -6
  56. DIRAC/Core/scripts/dirac_platform.py +1 -92
  57. DIRAC/DataManagementSystem/Agent/FTS3Agent.py +8 -7
  58. DIRAC/DataManagementSystem/Agent/RequestOperations/RemoveFile.py +7 -6
  59. DIRAC/DataManagementSystem/Client/FTS3Job.py +71 -34
  60. DIRAC/DataManagementSystem/DB/FTS3DB.py +7 -3
  61. DIRAC/DataManagementSystem/DB/FileCatalogComponents/DatasetManager/DatasetManager.py +1 -1
  62. DIRAC/DataManagementSystem/DB/FileCatalogDB.sql +9 -9
  63. DIRAC/DataManagementSystem/DB/FileCatalogWithFkAndPsDB.sql +9 -9
  64. DIRAC/DataManagementSystem/Utilities/DMSHelpers.py +6 -2
  65. DIRAC/DataManagementSystem/scripts/dirac_admin_allow_se.py +13 -8
  66. DIRAC/DataManagementSystem/scripts/dirac_admin_ban_se.py +13 -8
  67. DIRAC/DataManagementSystem/scripts/dirac_dms_create_moving_request.py +2 -0
  68. DIRAC/DataManagementSystem/scripts/dirac_dms_protocol_matrix.py +0 -1
  69. DIRAC/FrameworkSystem/Client/BundleDeliveryClient.py +2 -7
  70. DIRAC/FrameworkSystem/Client/ComponentInstaller.py +9 -4
  71. DIRAC/FrameworkSystem/Client/ProxyManagerClient.py +5 -2
  72. DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py +11 -6
  73. DIRAC/FrameworkSystem/ConfigTemplate.cfg +2 -0
  74. DIRAC/FrameworkSystem/DB/AuthDB.py +3 -3
  75. DIRAC/FrameworkSystem/DB/InstalledComponentsDB.py +4 -4
  76. DIRAC/FrameworkSystem/DB/ProxyDB.py +11 -3
  77. DIRAC/FrameworkSystem/DB/TokenDB.py +1 -1
  78. DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py +8 -6
  79. DIRAC/FrameworkSystem/Utilities/MonitoringUtilities.py +2 -19
  80. DIRAC/FrameworkSystem/Utilities/TokenManagementUtilities.py +3 -2
  81. DIRAC/FrameworkSystem/Utilities/diracx.py +36 -14
  82. DIRAC/FrameworkSystem/private/authorization/AuthServer.py +2 -2
  83. DIRAC/FrameworkSystem/scripts/dirac_admin_update_pilot.py +18 -11
  84. DIRAC/FrameworkSystem/scripts/dirac_login.py +2 -2
  85. DIRAC/FrameworkSystem/scripts/dirac_proxy_init.py +7 -8
  86. DIRAC/Interfaces/API/Dirac.py +27 -15
  87. DIRAC/Interfaces/API/DiracAdmin.py +45 -17
  88. DIRAC/Interfaces/API/Job.py +9 -13
  89. DIRAC/Interfaces/scripts/dirac_admin_allow_site.py +12 -18
  90. DIRAC/Interfaces/scripts/dirac_admin_ban_site.py +12 -10
  91. DIRAC/Interfaces/scripts/dirac_admin_get_site_mask.py +4 -13
  92. DIRAC/Interfaces/scripts/dirac_admin_reset_job.py +3 -6
  93. DIRAC/Interfaces/scripts/dirac_wms_job_parameters.py +0 -1
  94. DIRAC/MonitoringSystem/Client/Types/WMSHistory.py +4 -0
  95. DIRAC/MonitoringSystem/Client/WebAppClient.py +26 -0
  96. DIRAC/MonitoringSystem/ConfigTemplate.cfg +9 -0
  97. DIRAC/MonitoringSystem/DB/MonitoringDB.py +6 -25
  98. DIRAC/MonitoringSystem/Service/MonitoringHandler.py +0 -33
  99. DIRAC/MonitoringSystem/Service/WebAppHandler.py +599 -0
  100. DIRAC/MonitoringSystem/private/MainReporter.py +0 -3
  101. DIRAC/ProductionSystem/DB/ProductionDB.sql +4 -4
  102. DIRAC/ProductionSystem/scripts/dirac_prod_get.py +2 -2
  103. DIRAC/ProductionSystem/scripts/dirac_prod_get_all.py +2 -2
  104. DIRAC/ProductionSystem/scripts/dirac_prod_get_trans.py +2 -3
  105. DIRAC/RequestManagementSystem/Agent/RequestExecutingAgent.py +8 -6
  106. DIRAC/RequestManagementSystem/Agent/RequestOperations/ForwardDISET.py +2 -14
  107. DIRAC/RequestManagementSystem/Client/ReqClient.py +66 -13
  108. DIRAC/RequestManagementSystem/ConfigTemplate.cfg +6 -6
  109. DIRAC/RequestManagementSystem/DB/RequestDB.py +10 -5
  110. DIRAC/RequestManagementSystem/DB/test/RMSTestScenari.py +2 -0
  111. DIRAC/RequestManagementSystem/private/RequestValidator.py +40 -46
  112. DIRAC/ResourceStatusSystem/Client/SiteStatus.py +4 -2
  113. DIRAC/ResourceStatusSystem/Command/FreeDiskSpaceCommand.py +3 -1
  114. DIRAC/ResourceStatusSystem/DB/ResourceManagementDB.py +8 -8
  115. DIRAC/ResourceStatusSystem/DB/ResourceStatusDB.py +2 -2
  116. DIRAC/ResourceStatusSystem/Utilities/CSHelpers.py +2 -31
  117. DIRAC/ResourceStatusSystem/scripts/dirac_rss_set_status.py +30 -12
  118. DIRAC/Resources/Catalog/RucioFileCatalogClient.py +195 -1
  119. DIRAC/Resources/Catalog/test/Test_RucioFileCatalogClient.py +181 -0
  120. DIRAC/Resources/Computing/AREXComputingElement.py +25 -8
  121. DIRAC/Resources/Computing/BatchSystems/Condor.py +126 -108
  122. DIRAC/Resources/Computing/BatchSystems/SLURM.py +5 -1
  123. DIRAC/Resources/Computing/BatchSystems/test/Test_SLURM.py +46 -0
  124. DIRAC/Resources/Computing/ComputingElement.py +1 -1
  125. DIRAC/Resources/Computing/HTCondorCEComputingElement.py +44 -44
  126. DIRAC/Resources/Computing/InProcessComputingElement.py +4 -2
  127. DIRAC/Resources/Computing/LocalComputingElement.py +1 -18
  128. DIRAC/Resources/Computing/SSHBatchComputingElement.py +1 -17
  129. DIRAC/Resources/Computing/SSHComputingElement.py +1 -18
  130. DIRAC/Resources/Computing/SingularityComputingElement.py +19 -5
  131. DIRAC/Resources/Computing/test/Test_HTCondorCEComputingElement.py +67 -49
  132. DIRAC/Resources/Computing/test/Test_PoolComputingElement.py +2 -1
  133. DIRAC/Resources/IdProvider/CheckInIdProvider.py +13 -0
  134. DIRAC/Resources/IdProvider/IdProviderFactory.py +11 -3
  135. DIRAC/Resources/MessageQueue/StompMQConnector.py +1 -1
  136. DIRAC/Resources/Storage/GFAL2_StorageBase.py +24 -15
  137. DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingHTTPJson.py +1 -3
  138. DIRAC/Resources/Storage/StorageBase.py +4 -2
  139. DIRAC/Resources/Storage/StorageElement.py +6 -7
  140. DIRAC/StorageManagementSystem/DB/StorageManagementDB.sql +2 -2
  141. DIRAC/TransformationSystem/Agent/TaskManagerAgentBase.py +10 -16
  142. DIRAC/TransformationSystem/Agent/TransformationAgent.py +22 -1
  143. DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py +16 -16
  144. DIRAC/TransformationSystem/Client/TaskManager.py +2 -4
  145. DIRAC/TransformationSystem/Client/Transformation.py +6 -7
  146. DIRAC/TransformationSystem/Client/TransformationClient.py +21 -11
  147. DIRAC/TransformationSystem/Client/Utilities.py +9 -0
  148. DIRAC/TransformationSystem/DB/TransformationDB.py +11 -14
  149. DIRAC/TransformationSystem/DB/TransformationDB.sql +9 -9
  150. DIRAC/TransformationSystem/Service/TransformationManagerHandler.py +0 -333
  151. DIRAC/TransformationSystem/Utilities/ReplicationCLIParameters.py +3 -3
  152. DIRAC/TransformationSystem/Utilities/TransformationInfo.py +7 -5
  153. DIRAC/TransformationSystem/scripts/dirac_production_runjoblocal.py +2 -4
  154. DIRAC/TransformationSystem/test/Test_TransformationInfo.py +22 -15
  155. DIRAC/TransformationSystem/test/Test_replicationTransformation.py +5 -6
  156. DIRAC/Workflow/Modules/test/Test_Modules.py +5 -0
  157. DIRAC/WorkloadManagementSystem/Agent/JobAgent.py +38 -26
  158. DIRAC/WorkloadManagementSystem/Agent/JobCleaningAgent.py +12 -8
  159. DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py +4 -3
  160. DIRAC/WorkloadManagementSystem/Agent/PushJobAgent.py +13 -13
  161. DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py +18 -14
  162. DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py +18 -51
  163. DIRAC/WorkloadManagementSystem/Agent/StatesAccountingAgent.py +41 -1
  164. DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobAgent.py +45 -4
  165. DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobCleaningAgent.py +7 -9
  166. DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_PushJobAgent.py +1 -0
  167. DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py +9 -2
  168. DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_StalledJobAgent.py +4 -5
  169. DIRAC/WorkloadManagementSystem/Client/DownloadInputData.py +9 -9
  170. DIRAC/WorkloadManagementSystem/Client/InputDataResolution.py +6 -6
  171. DIRAC/WorkloadManagementSystem/Client/JobMonitoringClient.py +10 -11
  172. DIRAC/WorkloadManagementSystem/Client/JobReport.py +1 -1
  173. DIRAC/WorkloadManagementSystem/Client/JobState/CachedJobState.py +3 -0
  174. DIRAC/WorkloadManagementSystem/Client/JobState/JobManifest.py +32 -261
  175. DIRAC/WorkloadManagementSystem/Client/JobState/JobState.py +6 -0
  176. DIRAC/WorkloadManagementSystem/Client/JobStateUpdateClient.py +3 -0
  177. DIRAC/WorkloadManagementSystem/Client/JobStatus.py +8 -152
  178. DIRAC/WorkloadManagementSystem/Client/PoolXMLSlice.py +12 -19
  179. DIRAC/WorkloadManagementSystem/Client/SandboxStoreClient.py +25 -38
  180. DIRAC/WorkloadManagementSystem/Client/WMSClient.py +2 -3
  181. DIRAC/WorkloadManagementSystem/Client/test/Test_Client_DownloadInputData.py +29 -0
  182. DIRAC/WorkloadManagementSystem/ConfigTemplate.cfg +4 -8
  183. DIRAC/WorkloadManagementSystem/DB/JobDB.py +89 -132
  184. DIRAC/WorkloadManagementSystem/DB/JobDB.sql +8 -8
  185. DIRAC/WorkloadManagementSystem/DB/JobDBUtils.py +18 -147
  186. DIRAC/WorkloadManagementSystem/DB/JobLoggingDB.py +19 -6
  187. DIRAC/WorkloadManagementSystem/DB/JobParametersDB.py +9 -9
  188. DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.py +16 -5
  189. DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.sql +3 -3
  190. DIRAC/WorkloadManagementSystem/DB/SandboxMetadataDB.py +44 -82
  191. DIRAC/WorkloadManagementSystem/DB/StatusUtils.py +125 -0
  192. DIRAC/WorkloadManagementSystem/DB/tests/Test_JobDB.py +1 -1
  193. DIRAC/WorkloadManagementSystem/DB/tests/Test_StatusUtils.py +28 -0
  194. DIRAC/WorkloadManagementSystem/Executor/JobSanity.py +5 -4
  195. DIRAC/WorkloadManagementSystem/Executor/JobScheduling.py +4 -0
  196. DIRAC/WorkloadManagementSystem/FutureClient/JobStateUpdateClient.py +75 -33
  197. DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py +22 -11
  198. DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapperTemplate.py +9 -10
  199. DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py +60 -10
  200. DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapperTemplate.py +4 -0
  201. DIRAC/WorkloadManagementSystem/Service/JobManagerHandler.py +33 -154
  202. DIRAC/WorkloadManagementSystem/Service/JobMonitoringHandler.py +5 -323
  203. DIRAC/WorkloadManagementSystem/Service/JobStateUpdateHandler.py +0 -16
  204. DIRAC/WorkloadManagementSystem/Service/PilotManagerHandler.py +6 -103
  205. DIRAC/WorkloadManagementSystem/Service/SandboxStoreHandler.py +7 -53
  206. DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py +16 -79
  207. DIRAC/WorkloadManagementSystem/Service/WMSUtilities.py +4 -18
  208. DIRAC/WorkloadManagementSystem/Utilities/JobModel.py +28 -209
  209. DIRAC/WorkloadManagementSystem/Utilities/JobParameters.py +65 -3
  210. DIRAC/WorkloadManagementSystem/Utilities/JobStatusUtility.py +2 -64
  211. DIRAC/WorkloadManagementSystem/Utilities/ParametricJob.py +7 -171
  212. DIRAC/WorkloadManagementSystem/Utilities/PilotCStoJSONSynchronizer.py +73 -7
  213. DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py +41 -11
  214. DIRAC/WorkloadManagementSystem/Utilities/RemoteRunner.py +16 -0
  215. DIRAC/WorkloadManagementSystem/Utilities/Utils.py +36 -1
  216. DIRAC/WorkloadManagementSystem/Utilities/jobAdministration.py +15 -0
  217. DIRAC/WorkloadManagementSystem/Utilities/test/Test_JobModel.py +1 -15
  218. DIRAC/WorkloadManagementSystem/Utilities/test/Test_ParametricJob.py +45 -128
  219. DIRAC/WorkloadManagementSystem/Utilities/test/Test_PilotWrapper.py +16 -0
  220. DIRAC/WorkloadManagementSystem/scripts/dirac_jobexec.py +7 -2
  221. DIRAC/WorkloadManagementSystem/scripts/dirac_wms_pilot_job_info.py +1 -1
  222. DIRAC/__init__.py +62 -60
  223. DIRAC/tests/Utilities/testJobDefinitions.py +22 -28
  224. {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/METADATA +8 -5
  225. {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/RECORD +229 -228
  226. {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/WHEEL +1 -1
  227. {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info}/entry_points.txt +0 -3
  228. DIRAC/Core/Utilities/test/Test_List.py +0 -150
  229. DIRAC/Core/Utilities/test/Test_Time.py +0 -88
  230. DIRAC/Resources/Computing/PilotBundle.py +0 -70
  231. DIRAC/TransformationSystem/scripts/dirac_transformation_archive.py +0 -30
  232. DIRAC/TransformationSystem/scripts/dirac_transformation_clean.py +0 -30
  233. DIRAC/TransformationSystem/scripts/dirac_transformation_remove_output.py +0 -30
  234. DIRAC/WorkloadManagementSystem/Utilities/test/Test_JobManager.py +0 -58
  235. {DIRAC-9.0.0a42.dist-info → dirac-9.0.7.dist-info/licenses}/LICENSE +0 -0
  236. {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, state=None):
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, state)
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, S_ERROR
29
- from DIRAC import gConfig, gLogger
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
- # FIXME: use Operations() object
42
- pilotVersion = gConfig.getValue(f"Operations/{vo}/Pilot/Version", [])
43
- if not pilotVersion:
44
- return S_ERROR(f"No pilot version set under Operations/{vo}/Pilot/Version in CS")
45
-
46
- pilotVersion.pop()
47
- pilotVersion.insert(0, version)
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
- api.setOption(f"Operations/{vo}/Pilot/Version", ", ".join(pilotVersion))
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 = gConfig.getValue(f"Operations/{vo}/Pilot/Version")
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 = getVOMSVOForGroup(self.group)
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 gLogger, gConfig, S_OK, S_ERROR
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.FrameworkSystem.Client import ProxyGeneration, ProxyUpload
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.ConfigurationSystem.Client.Helpers import Registry
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.getVOMSVOForGroup(self.__piParams.diracGroup)
99
+ self.__proxyGenerated, attribute=vomsAttr, vo=Registry.getVOForGroup(self.__piParams.diracGroup)
101
100
  )
102
101
  if not resultVomsAttributes["OK"]:
103
102
  return S_ERROR(
@@ -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
- filterRes = JobStatus.filterJobStateTransition(jobIDs, filterState)
1456
- if not filterRes["OK"]:
1457
- return filterRes
1458
- filteredJobs.update(filterRes["Value"])
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
- # Remove any job IDs that can't change to the rescheduled state
1486
- filterRes = JobStatus.filterJobStateTransition(jobIDs, JobStatus.RESCHEDULED)
1487
- if not filterRes["OK"]:
1488
- return filterRes
1489
- jobIDsToReschedule = filterRes["Value"]
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
- filterRes = JobStatus.filterJobStateTransition(jobIDs, filterState)
1516
- if not filterRes["OK"]:
1517
- return filterRes
1518
- filteredJobs.update(filterRes["Value"])
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
- if not (result := self.sitestatus.setSiteStatus(site, "Active", comment))["OK"]:
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
- if not (result := self.sitestatus.setSiteStatus(site, "Banned", comment))["OK"]:
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
- result = PilotManagerClient().killPilot(gridReference)
463
- return result
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):
@@ -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.ObjectLoader import ObjectLoader
41
- from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
42
- from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getVOForGroup
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 getStepDefinition, addStepToWorkflow
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
- print("ERROR: Could not obtain current username from proxy")
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
- print("Automatic email disabled by flag.")
78
+ gLogger.warn("Automatic email disabled by flag.")
85
79
 
86
80
  for error in errorList:
87
- print("ERROR %s: %s" % error)
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
- print("ERROR: Could not obtain current username from proxy")
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
- print("Automatic email disabled by flag.")
87
+ gLogger.warn("Automatic email disabled by flag.")
86
88
 
87
89
  for error in errorList:
88
- print("ERROR %s: %s" % error)
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
- diracAdmin = DiracAdmin()
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
- print(f"Reset Job {job}")
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
- print("ERROR %s: %s" % error)
42
+ gLogger.error(error)
46
43
 
47
44
  DIRAC.exit(exitCode)
48
45
 
@@ -17,7 +17,6 @@ Example:
17
17
  'LocalAccount': 'prod006',
18
18
  'LocalBatchID': '',
19
19
  'LocalJobID': '277821.ce.labmc.inf.utfsm.cl',
20
- 'MatcherServiceTime': '2.27646398544',
21
20
  'Memory(kB)': '858540kB',
22
21
  'ModelName': 'Intel(R)Xeon(R)CPU5110@1.60GHz',
23
22
  'NormCPUTime(s)': '1.02',
@@ -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
@@ -28,4 +28,13 @@ Services
28
28
  }
29
29
  }
30
30
  ##END
31
+ ##BEGIN WebApp
32
+ WebApp
33
+ {
34
+ Port = 9199
35
+ Authorization
36
+ {
37
+ Default = authenticated
38
+ }
39
+ }
31
40
  }