Skip to content

Commit

Permalink
Do not change the state of jobs if a state update is received after they
Browse files Browse the repository at this point in the history
are set to a terminal state.
  • Loading branch information
natefoo committed Sep 16, 2015
1 parent 88abd34 commit d3bd0fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/galaxy/jobs/__init__.py
Expand Up @@ -1036,6 +1036,10 @@ def mark_as_resubmitted( self, info=None ):
def change_state( self, state, info=False ):
job = self.get_job()
self.sa_session.refresh( job )
if job.state in model.Job.terminal_states:
log.warning( "(%s) Ignoring state change from '%s' to '%s' for job "
"that is already terminal", job.id, job.state, state )
return
for dataset_assoc in job.output_datasets + job.output_library_datasets:
dataset = dataset_assoc.dataset
self.sa_session.refresh( dataset )
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/model/__init__.py
Expand Up @@ -317,6 +317,9 @@ class Job( object, HasJobMetrics, Dictifiable ):
PAUSED = 'paused',
DELETED = 'deleted',
DELETED_NEW = 'deleted_new' )
terminal_states = [ states.OK,
states.ERROR,
states.DELETED ]
# Please include an accessor (get/set pair) for any new columns/members.
def __init__( self ):
self.session_id = None
Expand Down

0 comments on commit d3bd0fa

Please sign in to comment.