Add conditional for use_cached_job to workflow run form

Surprisingly the API endpoint that is used by the UI is a little different from
the `create` endpoint the tests are testing, so this also adds a change in how
the `use_cached_job` is passed along.
This commit is contained in:
mvdbeek
2017-12-31 18:06:49 +02:00
parent 1c4476a6af
commit c6468f0677
2 changed files with 31 additions and 0 deletions
@@ -200,6 +200,7 @@ var View = Backbone.View.extend({
this._renderMessage();
this._renderParameters();
this._renderHistory();
this._renderUseCachedJob();
_.each(this.steps, step => {
self._renderStep(step);
});
@@ -311,6 +312,28 @@ var View = Backbone.View.extend({
this._append(this.$steps, this.history_form.$el);
},
/** Render job caching option */
_renderUseCachedJob: function() {
this.job_options_form = new Form({
cls: "ui-portlet-narrow",
title: "<b>Job re-use Options</b>",
inputs: [
{
type: "conditional",
name: "use_cached_job",
test_param: {
name: "check",
label: "BETA: Attempt to reuse jobs with identical parameters?",
type: "boolean",
value: "false",
help: "This may skip executing jobs that you have already run."
},
}
]
});
this._append(this.$steps, this.job_options_form.$el);
},
/** Render step */
_renderStep: function(step) {
var self = this;
@@ -497,8 +520,10 @@ var View = Backbone.View.extend({
_submit: function() {
var self = this;
var history_form_data = this.history_form.data.create();
var job_options_form_data = this.job_options_form.data.create();
var job_def = {
new_history_name: history_form_data["new_history|name"] ? history_form_data["new_history|name"] : null,
use_cached_job: true ? job_options_form_data["use_cached_job|check"] === 'true' : false,
history_id: !history_form_data["new_history|name"] ? this.model.get("history_id") : null,
replacement_params: this.wp_form ? this.wp_form.data.create() : {},
parameters: {},
+6
View File
@@ -347,6 +347,7 @@ def workflow_run_config_to_request(trans, run_config, workflow):
target_history=run_config.target_history,
replacement_dict=run_config.replacement_dict,
copy_inputs_to_history=False,
use_cached_job=run_config.use_cached_job,
inputs={},
param_map={},
allow_tool_state_corrections=run_config.allow_tool_state_corrections
@@ -372,6 +373,7 @@ def workflow_run_config_to_request(trans, run_config, workflow):
workflow_invocation.add_input(content, step_id)
add_parameter("copy_inputs_to_history", "true" if run_config.copy_inputs_to_history else "false", param_types.META_PARAMETERS)
add_parameter("use_cached_job", "true" if run_config.use_cached_job else "false", param_types.META_PARAMETERS)
return workflow_invocation
@@ -382,6 +384,7 @@ def workflow_request_to_run_config(work_request_context, workflow_invocation):
inputs = {}
param_map = {}
copy_inputs_to_history = None
use_cached_job = False
for parameter in workflow_invocation.input_parameters:
parameter_type = parameter.type
@@ -390,6 +393,8 @@ def workflow_request_to_run_config(work_request_context, workflow_invocation):
elif parameter_type == param_types.META_PARAMETERS:
if parameter.name == "copy_inputs_to_history":
copy_inputs_to_history = (parameter.value == "true")
if parameter.name == 'use_cached_job':
use_cached_job = (parameter.value == 'true')
for input_association in workflow_invocation.input_datasets:
inputs[input_association.workflow_step_id] = input_association.dataset
for input_association in workflow_invocation.input_dataset_collections:
@@ -404,6 +409,7 @@ def workflow_request_to_run_config(work_request_context, workflow_invocation):
inputs=inputs,
param_map=param_map,
copy_inputs_to_history=copy_inputs_to_history,
use_cached_job=use_cached_job,
)
return workflow_run_config