Skip to content

Commit 0b31773

Browse files
committed
fix: add a sleep to let the test pass
1 parent 16ab59f commit 0b31773

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/DIRAC/WorkloadManagementSystem/Utilities/jobAdministration.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +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
8+
from DIRAC.WorkloadManagementSystem.Service.JobPolicy import RIGHT_KILL, RIGHT_DELETE
99

1010

1111
def _deleteJob(jobID, force=False):
@@ -85,19 +85,13 @@ def kill_delete_jobs(right, validJobList, nonauthJobList=[], force=False):
8585
return filterRes
8686
killJobList.extend(filterRes["Value"])
8787

88-
if not right == RIGHT_KILL:
88+
if right == RIGHT_DELETE:
8989
# Get the jobs allowed to transition to the Deleted state
9090
filterRes = filterJobStateTransition(validJobList, JobStatus.DELETED)
9191
if not filterRes["OK"]:
9292
return filterRes
9393
deleteJobList.extend(filterRes["Value"])
9494

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-
10195
for jobID in killJobList:
10296
result = _killJob(jobID, force=force)
10397
if not result["OK"]:
@@ -108,6 +102,12 @@ def kill_delete_jobs(right, validJobList, nonauthJobList=[], force=False):
108102
if not result["OK"]:
109103
badIDs.append(jobID)
110104

105+
# Look for jobs that are in the Staging state to send kill signal to the stager
106+
result = JobDB().getJobsAttributes(killJobList, ["Status"])
107+
if not result["OK"]:
108+
return result
109+
stagingJobList = [jobID for jobID, sDict in result["Value"].items() if sDict["Status"] == JobStatus.STAGING]
110+
111111
if stagingJobList:
112112
stagerDB = StorageManagementDB()
113113
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
@@ -453,6 +453,7 @@ def test_JobStateUpdateAndJobMonitoringMultiple(lfn: str) -> None:
453453
finally:
454454
res = jobManagerClient.killJob(jobIDs)
455455
assert res["OK"], res["Message"]
456+
time.sleep(5)
456457
res = jobManagerClient.deleteJob(jobIDs)
457458
assert res["OK"], res["Message"]
458459
res = jobManagerClient.removeJob(jobIDs)

0 commit comments

Comments
 (0)