Handle input params correctly for rerun_invocation()#395
Handle input params correctly for rerun_invocation()#395simonbray wants to merge 6 commits intogalaxyproject:mainfrom
Conversation
| 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()}) |
There was a problem hiding this comment.
@nsoranzo I found that the params option was not working correctly so I removed it (as params can also be submitted via inputs) - does this look like an okay alternative?
There was a problem hiding this comment.
Mmmh, what's not working for you? I notice two issues:
invocation_details['input_step_parameters']seems to be never populated by Galaxy, soparams_updateshould actually be justparamsas ininvoke_workflow()payload = {'inputs': inputs, 'params': wf_params}should have beenpayload = {'inputs': inputs, 'parameters': wf_params}
Does that help?
There was a problem hiding this comment.
invocation_details['input_step_parameters'] seems to be never populated by Galaxy, so params_update should actually be just params as in invoke_workflow()
It does, but only if the input parameter is labelled.
payload = {'inputs': inputs, 'params': wf_params} should have been payload = {'inputs': inputs, 'parameters': wf_params}
Whoops, maybe that was it - I'll try that, thanks!
There was a problem hiding this comment.
@nsoranzo it seems that params doesn't work with runtime parameters, can you confirm if that's the case?
There was a problem hiding this comment.
At least I couldn't get it to work with a runtime parameter, and the documentation:
The ``params`` dict should be specified as follows::
{STEP_ID: PARAM_DICT, ...}
where PARAM_DICT is::
{PARAM_NAME: VALUE, ...}
doesn't really make sense for a runtime parameter.
There was a problem hiding this comment.
This seems to make it clear that runtime parameters belong in inputs, not parameters: https://github.com/galaxyproject/galaxy/blob/dev/lib/galaxy/workflow/run_request.py#L282-L285
There was a problem hiding this comment.
@nsoranzo would it be okay if we merge this? I would like to finish https://github.com/galaxyproject/planemo/pull/1140/files and I feel this should be completed first.
I am pretty confident that runtime parameters can only be submitted via inputs, see the two comments above. Also that's how Planemo is doing it: https://github.com/galaxyproject/planemo/blob/master/planemo/galaxy/activity.py#L165
As a result these two lines are needed to 1) get the runtime parameters from the original invocation's input_step_parameters 2) use the workflow_step_ids to match them with the numeric step ids. Then the numeric step ids can be used to update inputs and invoke the new workflow.
I can also split the last two commits into a separate PR if you prefer so we can merge at least the first one (the remapping bit).
No description provided.