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
@@ -16,14 +16,12 @@ from datetime import datetime, timedelta
16
16
 
17
17
  # # from DIRAC
18
18
  from DIRAC import S_ERROR, S_OK
19
- from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData
20
19
  from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
21
20
  from DIRAC.Core.Base.AgentModule import AgentModule
22
21
  from DIRAC.Core.Utilities.DErrno import cmpError
23
22
  from DIRAC.Core.Utilities.List import breakListIntoChunks
24
23
  from DIRAC.Core.Utilities.Proxy import executeWithUserProxy
25
24
  from DIRAC.Core.Utilities.ReturnValues import returnSingleResult
26
- from DIRAC.DataManagementSystem.Client.DataManager import DataManager
27
25
  from DIRAC.RequestManagementSystem.Client.File import File
28
26
  from DIRAC.RequestManagementSystem.Client.Operation import Operation
29
27
  from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient
@@ -34,8 +32,12 @@ from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient
34
32
  from DIRAC.Resources.Storage.StorageElement import StorageElement
35
33
  from DIRAC.TransformationSystem.Client import TransformationStatus
36
34
  from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
37
- from DIRAC.WorkloadManagementSystem.Client.JobMonitoringClient import JobMonitoringClient
38
- from DIRAC.WorkloadManagementSystem.Client.WMSClient import WMSClient
35
+ from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB
36
+ from DIRAC.WorkloadManagementSystem.Service.JobPolicy import (
37
+ RIGHT_DELETE,
38
+ RIGHT_KILL,
39
+ )
40
+ from DIRAC.WorkloadManagementSystem.DB.StatusUtils import kill_delete_jobs
39
41
 
40
42
  # # agent's name
41
43
  AGENT_NAME = "Transformation/TransformationCleaningAgent"
@@ -59,12 +61,12 @@ class TransformationCleaningAgent(AgentModule):
59
61
 
60
62
  # # transformation client
61
63
  self.transClient = None
62
- # # wms client
63
- self.wmsClient = None
64
64
  # # request client
65
65
  self.reqClient = None
66
66
  # # file catalog client
67
67
  self.metadataClient = None
68
+ # # JobDB
69
+ self.jobDB = None
68
70
 
69
71
  # # transformations types
70
72
  self.transformationTypes = None
@@ -119,14 +121,12 @@ class TransformationCleaningAgent(AgentModule):
119
121
 
120
122
  # # transformation client
121
123
  self.transClient = TransformationClient()
122
- # # wms client
123
- self.wmsClient = WMSClient()
124
124
  # # request client
125
125
  self.reqClient = ReqClient()
126
126
  # # file catalog client
127
127
  self.metadataClient = FileCatalogClient()
128
- # # job monitoring client
129
- self.jobMonitoringClient = JobMonitoringClient()
128
+ # # job DB
129
+ self.jobDB = JobDB()
130
130
 
131
131
  return S_OK()
132
132
 
@@ -224,7 +224,7 @@ class TransformationCleaningAgent(AgentModule):
224
224
  So, we should just clean from time to time.
225
225
  What I added here is done only when the agent finalize, and it's quite light-ish operation anyway.
226
226
  """
227
- res = self.jobMonitoringClient.getJobGroups(None, datetime.utcnow() - timedelta(days=365))
227
+ res = self.jobDB.getDistinctJobAttributes("JobGroup", None, datetime.utcnow() - timedelta(days=365))
228
228
  if not res["OK"]:
229
229
  self.log.error("Failed to get job groups", res["Message"])
230
230
  return res
@@ -268,7 +268,7 @@ class TransformationCleaningAgent(AgentModule):
268
268
 
269
269
  # Remove JobIDs that were unknown to the TransformationSystem
270
270
  jobGroupsToCheck = [str(transDict["TransformationID"]).zfill(8) for transDict in toClean + toArchive]
271
- res = self.jobMonitoringClient.getJobs({"JobGroup": jobGroupsToCheck})
271
+ res = self.jobDB.selectJobs({"JobGroup": jobGroupsToCheck})
272
272
  if not res["OK"]:
273
273
  return res
274
274
  jobIDsToRemove = [int(jobID) for jobID in res["Value"]]
@@ -610,8 +610,8 @@ class TransformationCleaningAgent(AgentModule):
610
610
  # Prevent 0 job IDs
611
611
  jobIDs = [int(j) for j in transJobIDs if int(j)]
612
612
  allRemove = True
613
- for jobList in breakListIntoChunks(jobIDs, 500):
614
- res = self.wmsClient.killJob(jobList, force=True)
613
+ for jobList in breakListIntoChunks(jobIDs, 1000):
614
+ res = kill_delete_jobs(RIGHT_KILL, jobList, force=True)
615
615
  if res["OK"]:
616
616
  self.log.info(f"Successfully killed {len(jobList)} jobs from WMS")
617
617
  elif ("InvalidJobIDs" in res) and ("NonauthorizedJobIDs" not in res) and ("FailedJobIDs" not in res):
@@ -623,7 +623,7 @@ class TransformationCleaningAgent(AgentModule):
623
623
  self.log.error("Failed to kill jobs", f"(n={len(res['FailedJobIDs'])})")
624
624
  allRemove = False
625
625
 
626
- res = self.wmsClient.deleteJob(jobList)
626
+ res = kill_delete_jobs(RIGHT_DELETE, jobList, force=True)
627
627
  if res["OK"]:
628
628
  self.log.info("Successfully deleted jobs from WMS", f"(n={len(jobList)})")
629
629
  elif ("InvalidJobIDs" in res) and ("NonauthorizedJobIDs" not in res) and ("FailedJobIDs" not in res):
@@ -684,7 +684,7 @@ class TransformationCleaningAgent(AgentModule):
684
684
 
685
685
  for index, lfnList in enumerate(breakListIntoChunks(lfns, 300)):
686
686
  oRequest = Request()
687
- requestName = "TCA_{transID}_{index}_{md5(repr(time.time()).encode()).hexdigest()[:5]}"
687
+ requestName = f"TCA_{transID}_{index}_{md5(repr(time.time()).encode()).hexdigest()[:5]}"
688
688
  oRequest.RequestName = requestName
689
689
  oOperation = Operation()
690
690
  oOperation.Type = "RemoveFile"
@@ -6,11 +6,9 @@ for managing jobs and requests tasks
6
6
 
7
7
  import time
8
8
 
9
- from DIRAC import S_OK, S_ERROR, gLogger
10
- from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
9
+ from DIRAC import S_ERROR, S_OK, gLogger
11
10
  from DIRAC.TransformationSystem.Agent.TransformationAgentsUtilities import TransformationAgentsUtilities
12
-
13
- COMPONENT_NAME = "TaskManager"
11
+ from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
14
12
 
15
13
 
16
14
  class TaskBase(TransformationAgentsUtilities):
@@ -4,16 +4,15 @@ See the information about transformation parameters below.
4
4
  """
5
5
  import json
6
6
 
7
- from DIRAC import gLogger, gConfig, S_OK, S_ERROR
7
+ from DIRAC import S_ERROR, S_OK, gConfig, gLogger
8
+ from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
9
+ from DIRAC.Core.Base.API import API
8
10
  from DIRAC.Core.Utilities.JEncode import encode
9
11
  from DIRAC.Core.Utilities.PromptUser import promptUser
10
- from DIRAC.Core.Base.API import API
12
+ from DIRAC.MonitoringSystem.Client.WebAppClient import WebAppClient
13
+ from DIRAC.RequestManagementSystem.Client.Operation import Operation
11
14
  from DIRAC.TransformationSystem.Client.BodyPlugin.BaseBody import BaseBody
12
15
  from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
13
- from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
14
- from DIRAC.RequestManagementSystem.Client.Operation import Operation
15
-
16
- COMPONENT_NAME = "Transformation"
17
16
 
18
17
 
19
18
  class Transformation(API):
@@ -500,7 +499,7 @@ class Transformation(API):
500
499
  ]
501
500
  dictList = []
502
501
 
503
- result = self.transClient.getTransformationSummaryWeb(condDict, orderby, start, maxitems)
502
+ result = WebAppClient().getTransformationSummaryWeb(condDict, orderby, start, maxitems)
504
503
  if not result["OK"]:
505
504
  self._prettyPrint(result)
506
505
  return result
@@ -1,9 +1,10 @@
1
- """ Class that contains client access to the transformation DB handler. """
1
+ """Class that contains client access to the transformation DB handler."""
2
2
 
3
3
  from DIRAC import S_OK, S_ERROR, gLogger
4
4
  from DIRAC.Core.Base.Client import Client, createClient
5
5
  from DIRAC.Core.Utilities.List import breakListIntoChunks
6
- from DIRAC.Core.Utilities.JEncode import decode as jdecode
6
+ from DIRAC.Core.Utilities.ReturnValues import convertToReturnValue, returnValueOrRaise
7
+ from DIRAC.Core.Utilities.JEncode import decode as jdecode, strToIntDict
7
8
  from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
8
9
  from DIRAC.TransformationSystem.Client import TransformationStatus
9
10
  from DIRAC.TransformationSystem.Client import TransformationFilesStatus
@@ -47,13 +48,6 @@ class TransformationClient(Client):
47
48
 
48
49
  getFileSummary(lfns)
49
50
  exists(lfns)
50
-
51
- Web monitoring tools
52
-
53
- getDistinctAttributeValues(attribute, selectDict)
54
- getTransformationStatusCounters()
55
- getTransformationSummary()
56
- getTransformationSummaryWeb(selectDict, sortList, startItem, maxItems)
57
51
  """
58
52
 
59
53
  def __init__(self, **kwargs):
@@ -62,8 +56,8 @@ class TransformationClient(Client):
62
56
  super().__init__(**kwargs)
63
57
  opsH = Operations()
64
58
  self.maxResetCounter = opsH.getValue("Transformations/FilesMaxResetCounter", 10)
65
-
66
- self.setServer("Transformation/TransformationManager")
59
+ if "url" not in kwargs:
60
+ self.setServer("Transformation/TransformationManager")
67
61
 
68
62
  def setServer(self, url):
69
63
  self.serverURL = url
@@ -591,3 +585,19 @@ class TransformationClient(Client):
591
585
  def addDirectory(self, path, force=False):
592
586
  rpcClient = self._getRPC()
593
587
  return rpcClient.addDirectory(path, force)
588
+
589
+ @convertToReturnValue
590
+ def getTransformationFilesCount(self, transName, field, selection=None, **kwargs):
591
+ if not selection:
592
+ selection = {}
593
+ rpcClient = self._getRPC(**kwargs)
594
+
595
+ files_count = returnValueOrRaise(rpcClient.getTransformationFilesCount(transName, field, selection))
596
+ # Some of these fields are LHCb specific, however:
597
+ # * it seems only LHCb uses this method
598
+ # * it will not be necessary with diracx & pydantic anymore
599
+ if field in ["TransformationID", "FileID", "TaskID", "ErrorCount", "RunNumber", "Size"]:
600
+ total = files_count.pop("Total")
601
+ files_count = strToIntDict(files_count)
602
+ files_count["Total"] = total
603
+ return files_count
@@ -9,6 +9,8 @@ Utilities for Transformation system
9
9
  import ast
10
10
  import random
11
11
 
12
+ from cachetools import LRUCache, cachedmethod
13
+ from cachetools.keys import hashkey
12
14
  from DIRAC import S_OK, S_ERROR, gLogger
13
15
 
14
16
  from DIRAC.Core.Utilities.List import breakListIntoChunks
@@ -22,6 +24,9 @@ from DIRAC.Resources.Catalog.FileCatalog import FileCatalog
22
24
  from DIRAC.Resources.Storage.StorageElement import StorageElement
23
25
  from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
24
26
 
27
+ # Module-level cache for isSameSEInList method (shared across PluginUtilities instances)
28
+ _is_same_se_in_list_cache = LRUCache(maxsize=1024)
29
+
25
30
 
26
31
  class PluginUtilities:
27
32
  """
@@ -400,6 +405,10 @@ class PluginUtilities:
400
405
 
401
406
  return StorageElement(se1).isSameSE(StorageElement(se2))
402
407
 
408
+ @cachedmethod(
409
+ lambda self: _is_same_se_in_list_cache,
410
+ key=lambda _, a, b: hashkey(a, *sorted(b)),
411
+ )
403
412
  def isSameSEInList(self, se1, seList):
404
413
  """Check if an SE is the same as any in a list"""
405
414
  if se1 in seList:
@@ -1,9 +1,9 @@
1
- """ DIRAC Transformation DB
1
+ """DIRAC Transformation DB
2
2
 
3
- Transformation database is used to collect and serve the necessary information
4
- in order to automate the task of job preparation for high level transformations.
5
- This class is typically used as a base class for more specific data processing
6
- databases
3
+ Transformation database is used to collect and serve the necessary information
4
+ in order to automate the task of job preparation for high level transformations.
5
+ This class is typically used as a base class for more specific data processing
6
+ databases
7
7
  """
8
8
 
9
9
  import re
@@ -397,14 +397,11 @@ class TransformationDB(DB):
397
397
  def __updateTransformationParameter(self, transID, paramName, paramValue, connection=False):
398
398
  if paramName not in self.mutable:
399
399
  return S_ERROR(f"Can not update the '{paramName}' transformation parameter")
400
- if paramName == "Body":
401
- res = self._escapeString(paramValue)
402
- if not res["OK"]:
403
- return S_ERROR("Failed to parse parameter value")
404
- paramValue = res["Value"]
405
- req = f"UPDATE Transformations SET {paramName}='{paramValue}', LastUpdate=UTC_TIMESTAMP() WHERE TransformationID={transID}"
406
- return self._update(req, conn=connection)
407
- req = f"UPDATE Transformations SET {paramName}='{paramValue}', LastUpdate=UTC_TIMESTAMP() WHERE TransformationID={transID}"
400
+ res = self._escapeString(paramValue)
401
+ if not res["OK"]:
402
+ return S_ERROR("Failed to parse parameter value")
403
+ paramValue = res["Value"]
404
+ req = f"UPDATE Transformations SET {paramName}={paramValue}, LastUpdate=UTC_TIMESTAMP() WHERE TransformationID={transID}"
408
405
  return self._update(req, conn=connection)
409
406
 
410
407
  def _getTransformationID(self, transName, connection=False):
@@ -709,7 +706,7 @@ class TransformationDB(DB):
709
706
  res = self.getCounters("TransformationFiles", ["TransformationID", field], selection)
710
707
  if not res["OK"]:
711
708
  return res
712
- countDict = {attrDict[field]: count for attrDict, count in res["Value"]}
709
+ countDict = {str(attrDict[field]): count for attrDict, count in res["Value"]}
713
710
  countDict["Total"] = sum(countDict.values())
714
711
  return S_OK(countDict)
715
712
 
@@ -48,7 +48,7 @@ CREATE TABLE Transformations(
48
48
  INDEX(TransformationFamily),
49
49
  INDEX(Status),
50
50
  INDEX(Type)
51
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
51
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
52
52
 
53
53
  -- -------------------------------------------------------------------------------
54
54
  DROP TABLE IF EXISTS DataFiles;
@@ -59,7 +59,7 @@ CREATE TABLE DataFiles(
59
59
  INDEX(Status),
60
60
  INDEX(LFN),
61
61
  PRIMARY KEY(FileID)
62
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
62
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
63
63
 
64
64
  -- -------------------------------------------------------------------------------
65
65
  DROP TABLE IF EXISTS AdditionalParameters;
@@ -70,7 +70,7 @@ CREATE TABLE AdditionalParameters(
70
70
  ParameterType VARCHAR(32) DEFAULT 'StringType',
71
71
  PRIMARY KEY(TransformationID, ParameterName),
72
72
  FOREIGN KEY(TransformationID) REFERENCES Transformations(TransformationID)
73
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
73
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
74
74
 
75
75
  -- -------------------------------------------------------------------------------
76
76
  DROP TABLE IF EXISTS TransformationLog;
@@ -84,7 +84,7 @@ CREATE TABLE TransformationLog(
84
84
  INDEX(TransformationID),
85
85
  INDEX(MessageDate),
86
86
  FOREIGN KEY(TransformationID) REFERENCES Transformations(TransformationID)
87
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
87
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
88
88
 
89
89
  -- -------------------------------------------------------------------------------
90
90
  DROP TABLE IF EXISTS TransformationTasks;
@@ -100,7 +100,7 @@ CREATE TABLE TransformationTasks(
100
100
  INDEX(ExternalStatus),
101
101
  INDEX(TransformationID,ExternalStatus),
102
102
  FOREIGN KEY(TransformationID) REFERENCES Transformations(TransformationID)
103
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
103
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
104
104
 
105
105
  -- This is required to mimic the AUTO_INCREMENT behavior of TaskID which was possible with MyISAM:
106
106
  CREATE TRIGGER `TaskID_Generator` BEFORE INSERT ON TransformationTasks
@@ -125,7 +125,7 @@ CREATE TABLE TransformationFiles(
125
125
  INDEX(TransformationID,Status),
126
126
  FOREIGN KEY(TransformationID) REFERENCES Transformations(TransformationID),
127
127
  FOREIGN KEY(FileID) REFERENCES DataFiles(FileID)
128
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
128
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
129
129
 
130
130
  -- -------------------------------------------------------------------------------
131
131
  DROP TABLE IF EXISTS TransformationFileTasks;
@@ -137,7 +137,7 @@ CREATE TABLE TransformationFileTasks(
137
137
  FOREIGN KEY(TransformationID) REFERENCES Transformations(TransformationID),
138
138
  FOREIGN KEY(TransformationID, FileID) REFERENCES TransformationFiles(TransformationID, FileID),
139
139
  FOREIGN KEY(TransformationID, TaskID) REFERENCES TransformationTasks(TransformationID, TaskID)
140
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
140
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
141
141
 
142
142
  -- -------------------------------------------------------------------------------
143
143
  DROP TABLE IF EXISTS TaskInputs;
@@ -147,7 +147,7 @@ CREATE TABLE TaskInputs(
147
147
  InputVector MEDIUMTEXT,
148
148
  PRIMARY KEY(TransformationID, TaskID),
149
149
  FOREIGN KEY(TransformationID, TaskID) REFERENCES TransformationTasks(TransformationID, TaskID)
150
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
150
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
151
151
 
152
152
  -- -------------------------------------------------------------------------------
153
153
  DROP TABLE IF EXISTS TransformationMetaQueries;
@@ -159,6 +159,6 @@ CREATE TABLE TransformationMetaQueries(
159
159
  QueryType ENUM('Input', 'Output') DEFAULT 'Input',
160
160
  PRIMARY KEY(TransformationID, MetaDataName, QueryType),
161
161
  FOREIGN KEY(TransformationID) REFERENCES Transformations(TransformationID)
162
- ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
162
+ ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
163
163
 
164
164
  SET FOREIGN_KEY_CHECKS = 1;