Add resume option for job dependencies

This commit is contained in:
guerler
2015-03-06 15:24:31 -05:00
parent f0bebc997f
commit d079ad8f8c
4 changed files with 46 additions and 3 deletions
@@ -295,6 +295,20 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
});
}
// add remap button
if (this.options.job_id && this.options.job_remap) {
options.inputs['rerun_remap_job_id'] = {
label : 'Resume dependencies from this job',
name : 'rerun_remap_job_id',
type : 'select',
display : 'radio',
ignore : '__ignore__',
value : '__ignore__',
options : [['Yes', this.options.job_id], ['No', '__ignore__']],
help : 'The previous run of this tool failed and other tools were waiting for it to finish successfully, use this option to resume those tools using the outputs of this tool run.'
}
}
// create tool form section
this.section = new ToolSection.View(self, {
inputs : options.inputs
+17 -2
View File
@@ -1215,7 +1215,8 @@ class Tool( object, Dictifiable ):
if 'rerun_remap_job_id' in incoming:
try:
rerun_remap_job_id = trans.app.security.decode_id( incoming[ 'rerun_remap_job_id' ] )
except Exception:
except Exception, exception:
log.error( str( exception ) )
message = 'Failure executing tool (attempting to rerun invalid job).'
return 'message.mako', dict( status='error', message=message, refresh_frames=[] )
@@ -2296,6 +2297,7 @@ class Tool( object, Dictifiable ):
params_to_incoming( kwd, self.inputs, job_params, trans.app, to_html=False )
except Exception, exception:
trans.response.status = 500
log.error( str( exception ) )
return { 'error': str( exception ) }
# create parameter object
@@ -2555,7 +2557,8 @@ class Tool( object, Dictifiable ):
'versions' : tool_versions,
'requirements' : tool_requirements,
'errors' : state_errors,
'state_inputs' : state_inputs
'state_inputs' : state_inputs,
'job_remap' : self._get_job_remap(job)
})
# check for errors
@@ -2565,6 +2568,18 @@ class Tool( object, Dictifiable ):
# return enriched tool model
return tool_model
def _get_job_remap ( self, job):
if job:
if job.state == job.states.ERROR:
return True
try:
if [ hda.dependent_jobs for hda in [ jtod.dataset for jtod in job.output_datasets ] if hda.dependent_jobs ]:
return True
except Exception, exception:
log.error( str( exception ) )
pass
return False
def _map_source_to_history(self, trans, tool_inputs, params):
# Need to remap dataset parameters. Job parameters point to original
# dataset used; parameter should be the analygous dataset in the
@@ -295,6 +295,20 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
});
}
// add remap button
if (this.options.job_id && this.options.job_remap) {
options.inputs['rerun_remap_job_id'] = {
label : 'Resume dependencies from this job',
name : 'rerun_remap_job_id',
type : 'select',
display : 'radio',
ignore : '__ignore__',
value : '__ignore__',
options : [['Yes', this.options.job_id], ['No', '__ignore__']],
help : 'The previous run of this tool failed and other tools were waiting for it to finish successfully, use this option to resume those tools using the outputs of this tool run.'
}
}
// create tool form section
this.section = new ToolSection.View(self, {
inputs : options.inputs
File diff suppressed because one or more lines are too long