Skip to content

Commit 3ae10f3

Browse files
committed
fix: do not request StorageManagementDB
1 parent 4577d07 commit 3ae10f3

File tree

4 files changed

+18
-34
lines changed

4 files changed

+18
-34
lines changed

src/DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:caption: TransformationCleaningAgent options
88
99
"""
10+
1011
# # imports
1112
import ast
1213
import errno
@@ -69,7 +70,6 @@ def __init__(self, *args, **kwargs):
6970
self.jobDB = None
7071
self.pilotAgentsDB = None
7172
self.taskQueueDB = None
72-
self.storageManagementDB = None
7373

7474
# # transformations types
7575
self.transformationTypes = None
@@ -144,11 +144,6 @@ def initialize(self):
144144
return result
145145
self.taskQueueDB = result["Value"]()
146146

147-
result = ObjectLoader().loadObject("StorageManagementSystem.DB.StorageManagementDB", "StorageManagementDB")
148-
if not result["OK"]:
149-
return result
150-
self.storageManagementDB = result["Value"]()
151-
152147
return S_OK()
153148

154149
#############################################################################
@@ -640,7 +635,6 @@ def __removeWMSTasks(self, transJobIDs):
640635
jobdb=self.jobDB,
641636
taskqueuedb=self.taskQueueDB,
642637
pilotagentsdb=self.pilotAgentsDB,
643-
storagemanagementdb=self.storageManagementDB,
644638
)
645639
# Prevent 0 job IDs
646640
jobIDs = [int(j) for j in transJobIDs if int(j)]

src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def __init__(self, *args, **kwargs):
4141
self.logDB = None
4242
self.taskQueueDB = None
4343
self.pilotAgentsDB = None
44-
self.storageManagementDB = None
4544
self.matchedTime = 7200
4645
self.rescheduledTime = 600
4746
self.submittingTime = 300
@@ -73,11 +72,6 @@ def initialize(self):
7372
return result
7473
self.pilotAgentsDB = result["Value"]()
7574

76-
result = ObjectLoader().loadObject("StorageManagementSystem.DB.StorageManagementDB", "StorageManagementDB")
77-
if not result["OK"]:
78-
return result
79-
self.storageManagementDB = result["Value"]()
80-
8175
# getting parameters
8276

8377
if not self.am_getOption("Enable", True):
@@ -267,7 +261,6 @@ def _failStalledJobs(self, jobID):
267261
jobdb=self.jobDB,
268262
taskqueuedb=self.taskQueueDB,
269263
pilotagentsdb=self.pilotAgentsDB,
270-
storagemanagementdb=self.storageManagementDB,
271264
)
272265
if not res["OK"]:
273266
self.log.error("Failed to kill job", jobID)

src/DIRAC/WorkloadManagementSystem/DB/StatusUtils.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from DIRAC import S_ERROR, S_OK, gLogger
2-
from DIRAC.WorkloadManagementSystem.Client import JobStatus
32
from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader
3+
from DIRAC.WorkloadManagementSystem.Client import JobStatus
44
from DIRAC.WorkloadManagementSystem.Service.JobPolicy import RIGHT_DELETE, RIGHT_KILL
55
from DIRAC.WorkloadManagementSystem.Utilities.jobAdministration import _filterJobStateTransition
66

@@ -96,11 +96,6 @@ def kill_delete_jobs(
9696
if not result["OK"]:
9797
return result
9898
pilotagentsdb = result["Value"]()
99-
if storagemanagementdb is None:
100-
result = ObjectLoader().loadObject("StorageManagementSystem.DB.StorageManagementDB", "StorageManagementDB")
101-
if not result["OK"]:
102-
return result
103-
storagemanagementdb = result["Value"]()
10499

105100
badIDs = []
106101

@@ -133,6 +128,14 @@ def kill_delete_jobs(
133128
stagingJobList = [jobID for jobID, sDict in jobStates.items() if sDict["Status"] == JobStatus.STAGING]
134129

135130
if stagingJobList:
131+
if storagemanagementdb is None:
132+
result = ObjectLoader().loadObject(
133+
"StorageManagementSystem.DB.StorageManagementDB", "StorageManagementDB"
134+
)
135+
if not result["OK"]:
136+
return result
137+
storagemanagementdb = result["Value"]()
138+
136139
gLogger.info("Going to send killing signal to stager as well!")
137140
result = storagemanagementdb.killTasksBySourceTaskID(stagingJobList)
138141
if not result["OK"]:

src/DIRAC/WorkloadManagementSystem/Service/JobManagerHandler.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
""" JobManagerHandler is the implementation of the JobManager service
2-
in the DISET framework
1+
"""JobManagerHandler is the implementation of the JobManager service
2+
in the DISET framework
33
4-
The following methods are available in the Service interface
4+
The following methods are available in the Service interface
55
6-
submitJob()
7-
rescheduleJob()
8-
deleteJob()
9-
killJob()
6+
submitJob()
7+
rescheduleJob()
8+
deleteJob()
9+
killJob()
1010
1111
"""
12+
1213
from pydantic import ValidationError
1314

1415
from DIRAC import S_ERROR, S_OK
@@ -65,11 +66,6 @@ def initializeHandler(cls, serviceInfoDict):
6566
return result
6667
cls.pilotAgentsDB = result["Value"](parentLogger=cls.log)
6768

68-
result = ObjectLoader().loadObject("StorageManagementSystem.DB.StorageManagementDB", "StorageManagementDB")
69-
if not result["OK"]:
70-
return result
71-
cls.storageManagementDB = result["Value"](parentLogger=cls.log)
72-
7369
except RuntimeError as excp:
7470
return S_ERROR(f"Can't connect to DB: {excp!r}")
7571

@@ -468,7 +464,6 @@ def export_deleteJob(self, jobIDs, force=False):
468464
jobdb=self.jobDB,
469465
taskqueuedb=self.taskQueueDB,
470466
pilotagentsdb=self.pilotAgentsDB,
471-
storagemanagementdb=self.storageManagementDB,
472467
)
473468

474469
result["requireProxyUpload"] = len(ownerJobList) > 0 and self.__checkIfProxyUploadIsRequired()
@@ -506,7 +501,6 @@ def export_killJob(self, jobIDs, force=False):
506501
jobdb=self.jobDB,
507502
taskqueuedb=self.taskQueueDB,
508503
pilotagentsdb=self.pilotAgentsDB,
509-
storagemanagementdb=self.storageManagementDB,
510504
)
511505

512506
result["requireProxyUpload"] = len(ownerJobList) > 0 and self.__checkIfProxyUploadIsRequired()

0 commit comments

Comments
 (0)