Skip to content

Commit ca3e663

Browse files
committed
fix: minor fix on deletion delay
1 parent 47eae18 commit ca3e663

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/JobCleaningAgent.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ def _getAllowedJobTypes(self):
103103
def execute(self):
104104
"""Remove or delete jobs in various status"""
105105

106-
# TODO: check the WMS SM before calling the functions below (v7r3)
107-
108106
# First, fully remove jobs in JobStatus.DELETED state
109107
result = self.removeDeletedJobs()
110108
if not result["OK"]:
@@ -143,14 +141,13 @@ def execute(self):
143141

144142
return S_OK()
145143

146-
def removeDeletedJobs(self, delay=False):
144+
def removeDeletedJobs(self):
147145
"""Fully remove jobs that are already in status "DELETED", unless there are still requests.
148146
149-
:param int delay: days of delay
150147
:returns: S_OK/S_ERROR
151148
"""
152149

153-
res = self._getJobsList({"Status": JobStatus.DELETED}, delay)
150+
res = self._getJobsList({"Status": JobStatus.DELETED})
154151
if not res["OK"]:
155152
return res
156153
jobList = res["Value"]
@@ -270,7 +267,7 @@ def _getJobsList(self, condDict, delay=None):
270267
:returns: S_OK with jobsList
271268
"""
272269
jobIDsS = set()
273-
delayStr = "and older than %s day(s)" % delay if delay else ""
270+
delayStr = "and older than %s" % delay if delay else ""
274271
self.log.info("Get jobs with %s %s" % (str(condDict), delayStr))
275272
for order in ["JobID:ASC", "JobID:DESC"]:
276273
result = self.jobDB.selectJobs(condDict, older=delay, orderAttribute=order, limit=self.maxJobsAtOnce)
@@ -282,8 +279,9 @@ def _getJobsList(self, condDict, delay=None):
282279

283280
def _getOwnerJobsDict(self, jobList):
284281
"""
285-
gets in input a list of int(JobID) and return a dict with a grouping of them by owner, e.g.
286-
{'dn;group': [1, 3, 4], 'dn;group_1': [5], 'dn_1;group': [2]}
282+
:param list jobList: list of int(JobID)
283+
284+
:returns: a dict with a grouping of them by owner, e.g.{'dn;group': [1, 3, 4], 'dn;group_1': [5], 'dn_1;group': [2]}
287285
"""
288286
res = self.jobDB.getJobsAttributes(jobList, ["OwnerDN", "OwnerGroup"])
289287
if not res["OK"]:

0 commit comments

Comments
 (0)