5
5
from DIRAC .WorkloadManagementSystem .DB .JobDB import JobDB
6
6
from DIRAC .WorkloadManagementSystem .DB .PilotAgentsDB import PilotAgentsDB
7
7
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
9
9
10
10
11
11
def _deleteJob (jobID , force = False ):
@@ -85,19 +85,13 @@ def kill_delete_jobs(right, validJobList, nonauthJobList=[], force=False):
85
85
return filterRes
86
86
killJobList .extend (filterRes ["Value" ])
87
87
88
- if not right == RIGHT_KILL :
88
+ if right == RIGHT_DELETE :
89
89
# Get the jobs allowed to transition to the Deleted state
90
90
filterRes = filterJobStateTransition (validJobList , JobStatus .DELETED )
91
91
if not filterRes ["OK" ]:
92
92
return filterRes
93
93
deleteJobList .extend (filterRes ["Value" ])
94
94
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
-
101
95
for jobID in killJobList :
102
96
result = _killJob (jobID , force = force )
103
97
if not result ["OK" ]:
@@ -108,6 +102,12 @@ def kill_delete_jobs(right, validJobList, nonauthJobList=[], force=False):
108
102
if not result ["OK" ]:
109
103
badIDs .append (jobID )
110
104
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
+
111
111
if stagingJobList :
112
112
stagerDB = StorageManagementDB ()
113
113
gLogger .info ("Going to send killing signal to stager as well!" )
0 commit comments