JobStatus
This module contains constants and lists for the possible job states.
- DIRAC.WorkloadManagementSystem.Client.JobStatus.CHECKING = 'Checking'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.COMPLETED = 'Completed'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.COMPLETING = 'Completing'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.DELETED = 'Deleted'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.DONE = 'Done'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.FAILED = 'Failed'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.JOB_STATES = ['Submitting', 'Received', 'Checking', 'Scouting', 'Staging', 'Waiting', 'Matched', 'Rescheduled', 'Running', 'Stalled', 'Completing', 'Done', 'Completed', 'Failed', 'Deleted', 'Killed']
Possible job states
- class DIRAC.WorkloadManagementSystem.Client.JobStatus.JobsStateMachine(state)
Bases:
StateMachine
Jobs state machine
- __init__(state)
c’tor Defines the state machine transactions
- getLevelOfState(state)
Given a state name, it returns its level (integer), which defines the hierarchy.
>>> sm0.getLevelOfState('Nirvana') 100 >>> sm0.getLevelOfState('AnotherState') -1
- Parameters:
state (str) – name of the state, it should be on <self.states> key set
- Returns:
int || -1 (if not in <self.states>)
- getNextState(candidateState)
Method that gets the next state, given the proposed transition to candidateState. If candidateState is not on the state map <self.states>, it is rejected. If it is not the case, we have two options: if <self.state> is None, then the next state will be <candidateState>. Otherwise, the current state is using its own transition rule to decide.
Examples
>>> sm0.getNextState(None) S_OK(None) >>> sm0.getNextState('NextState') S_OK('NextState')
- Parameters:
candidateState (str) – name of the next state
- Returns:
S_OK(nextState) || S_ERROR
- getStates()
Returns all possible states in the state map
Examples
>>> sm0.getStates() [ 'Nirvana' ]
- Returns:
list(stateNames)
- setState(candidateState, noWarn=False)
- Makes sure the state is either None or known to the machine, and that it is a valid state to move into.
Final states are also checked.
Examples
>>> sm0.setState(None)['OK'] True >>> sm0.setState('Nirvana')['OK'] True >>> sm0.setState('AnotherState')['OK'] False
- Parameters:
state (None or str) – state which will be set as current state of the StateMachine
- Returns:
S_OK || S_ERROR
- DIRAC.WorkloadManagementSystem.Client.JobStatus.KILLED = 'Killed'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.MATCHED = 'Matched'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.RECEIVED = 'Received'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.RESCHEDULED = 'Rescheduled'
The Rescheduled status is effectively never stored in the DB. It could be considered a “virtual” status, and might even be dropped.
- DIRAC.WorkloadManagementSystem.Client.JobStatus.RUNNING = 'Running'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.SCOUTING = 'Scouting'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.STAGING = 'Staging'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.STALLED = 'Stalled'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.SUBMITTING = 'Submitting'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.WAITING = 'Waiting'
- DIRAC.WorkloadManagementSystem.Client.JobStatus.checkJobStateTransition(jobID, candidateState, currentStatus=None, jobMonitoringClient=None)
Utility to check if a job state transition is allowed
Deprecated: Use filterJobStateTransition instead
- DIRAC.WorkloadManagementSystem.Client.JobStatus.filterJobStateTransition(jobIDs, candidateState)
Given a list of jobIDs, return a list that are allowed to transition to the given candidate state.