Skip to content

Commit a7612df

Browse files
committed
fix: removed deprecated function
1 parent 09fdfae commit a7612df

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

src/DIRAC/WorkloadManagementSystem/Client/JobStatus.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
This module contains constants and lists for the possible job states.
33
"""
44

5-
from DIRAC import gLogger, S_OK, S_ERROR
5+
from DIRAC import S_OK
66
from DIRAC.Core.Utilities.StateMachine import State, StateMachine
7-
from DIRAC.Core.Utilities.Decorators import deprecated
8-
97
from DIRAC.WorkloadManagementSystem.Client.JobMonitoringClient import JobMonitoringClient
108

11-
129
#:
1310
SUBMITTING = "Submitting"
1411
#:
@@ -100,37 +97,6 @@ def __init__(self, state):
10097
}
10198

10299

103-
@deprecated("Use filterJobStateTransition instead")
104-
def checkJobStateTransition(jobID, candidateState, currentStatus=None, jobMonitoringClient=None):
105-
"""Utility to check if a job state transition is allowed"""
106-
if not currentStatus:
107-
if not jobMonitoringClient:
108-
from DIRAC.WorkloadManagementSystem.Client.JobMonitoringClient import JobMonitoringClient
109-
110-
jobMonitoringClient = JobMonitoringClient()
111-
112-
res = jobMonitoringClient.getJobsStatus(jobID)
113-
if not res["OK"]:
114-
return res
115-
try:
116-
currentStatus = res["Value"][jobID]["Status"]
117-
except KeyError:
118-
return S_ERROR("Job does not exist")
119-
120-
res = JobsStateMachine(currentStatus).getNextState(candidateState)
121-
if not res["OK"]:
122-
return res
123-
124-
# If the JobsStateMachine does not accept the candidate, return an ERROR
125-
if candidateState != res["Value"]:
126-
gLogger.error(
127-
"Job Status Error",
128-
f"{jobID} can't move from {currentStatus} to {candidateState}",
129-
)
130-
return S_ERROR("Job state transition not allowed")
131-
return S_OK()
132-
133-
134100
def filterJobStateTransition(jobIDs, candidateState):
135101
"""Given a list of jobIDs, return a list that are allowed to transition
136102
to the given candidate state.

0 commit comments

Comments
 (0)