Skip to content

Commit 65d05fb

Browse files
committed
fix: add a sleep to let the test pass
1 parent 15db539 commit 65d05fb

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/DIRAC/WorkloadManagementSystem/Utilities/jobAdministration.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB
66
from DIRAC.WorkloadManagementSystem.DB.PilotAgentsDB import PilotAgentsDB
77
from DIRAC.WorkloadManagementSystem.DB.TaskQueueDB import TaskQueueDB
8-
from DIRAC.WorkloadManagementSystem.Service.JobPolicy import RIGHT_KILL
9-
8+
from DIRAC.WorkloadManagementSystem.Service.JobPolicy import RIGHT_KILL, RIGHT_DELETE
109

1110
def _deleteJob(jobID, force=False):
1211
"""Set the job status to "Deleted"
@@ -85,19 +84,13 @@ def kill_delete_jobs(right, validJobList, nonauthJobList=[], force=False):
8584
return filterRes
8685
killJobList.extend(filterRes["Value"])
8786

88-
if not right == RIGHT_KILL:
87+
if right == RIGHT_DELETE:
8988
# Get the jobs allowed to transition to the Deleted state
9089
filterRes = filterJobStateTransition(validJobList, JobStatus.DELETED)
9190
if not filterRes["OK"]:
9291
return filterRes
9392
deleteJobList.extend(filterRes["Value"])
9493

95-
# Look for jobs that are in the Staging state to send kill signal to the stager
96-
result = JobDB().getJobsAttributes(killJobList, ["Status"])
97-
if not result["OK"]:
98-
return result
99-
stagingJobList = [jobID for jobID, sDict in result["Value"].items() if sDict["Status"] == JobStatus.STAGING]
100-
10194
for jobID in killJobList:
10295
result = _killJob(jobID, force=force)
10396
if not result["OK"]:
@@ -108,6 +101,12 @@ def kill_delete_jobs(right, validJobList, nonauthJobList=[], force=False):
108101
if not result["OK"]:
109102
badIDs.append(jobID)
110103

104+
# Look for jobs that are in the Staging state to send kill signal to the stager
105+
result = JobDB().getJobsAttributes(killJobList, ["Status"])
106+
if not result["OK"]:
107+
return result
108+
stagingJobList = [jobID for jobID, sDict in result["Value"].items() if sDict["Status"] == JobStatus.STAGING]
109+
111110
if stagingJobList:
112111
stagerDB = StorageManagementDB()
113112
gLogger.info("Going to send killing signal to stager as well!")

tests/Integration/WorkloadManagementSystem/Test_Client_WMS.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ def test_JobStateUpdateAndJobMonitoringMultiple(lfn: str) -> None:
505505
finally:
506506
res = jobManagerClient.killJob(jobIDs)
507507
assert res["OK"], res["Message"]
508+
time.sleep(5)
508509
res = jobManagerClient.deleteJob(jobIDs)
509510
assert res["OK"], res["Message"]
510511
res = jobManagerClient.removeJob(jobIDs)

0 commit comments

Comments
 (0)