Skip to content

Commit

Permalink
handle input params correctly for rerun_invocation()
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbray committed May 14, 2021
1 parent b31051f commit 586aac6
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions bioblend/galaxy/invocations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def show_invocation(self, invocation_id):
return self._get(url=url)

def rerun_invocation(self, invocation_id: str, remap: bool = False, inputs_update: Optional[dict] = None,
params_update: Optional[dict] = None, history_id: Optional[str] = None,
history_id: Optional[str] = None,
history_name: Optional[str] = None, import_inputs_to_history: bool = False,
replacement_params: Optional[dict] = None, allow_tool_state_corrections: bool = False,
inputs_by: Optional[str] = None, parameters_normalized: bool = False):
Expand All @@ -152,15 +152,10 @@ def rerun_invocation(self, invocation_id: str, remap: bool = False, inputs_updat
an entire new invocation will be created, using the other parameters specified.
:type inputs_update: dict
:param inputs_update: If different datasets should be used to the original
:param inputs_update: If different datasets or parameters should be used to the original
invocation, this should contain a mapping of workflow inputs to the new
datasets and dataset collections.
:type params_update: dict
:param params_update: If different non-dataset tool parameters should be
used to the original invocation, this should contain a mapping of the
new parameter values.
:type history_id: str
:param history_id: The encoded history ID where to store the workflow
outputs. Alternatively, ``history_name`` may be specified to create a
Expand Down Expand Up @@ -221,14 +216,12 @@ def rerun_invocation(self, invocation_id: str, remap: bool = False, inputs_updat
invocation_details = self.show_invocation(invocation_id)
workflow_id = invocation_details['workflow_id']
inputs = invocation_details['inputs']
wf_params = invocation_details['input_step_parameters']
step_ids_to_indices = {step['workflow_step_id']: step_index for step_index, step in enumerate(invocation_details['steps'])}
inputs.update({step_ids_to_indices[param['workflow_step_id']]: param['parameter_value'] for _, param in invocation_details['input_step_parameters'].items()})
if inputs_update:
for inp, input_value in inputs_update.items():
inputs[inp] = input_value
if params_update:
for param, param_value in params_update.items():
wf_params[param] = param_value
payload = {'inputs': inputs, 'params': wf_params}
payload = {'inputs': inputs}

if replacement_params:
payload['replacement_params'] = replacement_params
Expand Down

0 comments on commit 586aac6

Please sign in to comment.