Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.1] Fix up local tool version handling #16836

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ export default {
inputs: response.inputs,
outputs: response.outputs,
tool_state: response.tool_state,
tool_version: response.tool_version,
});
});
},
Expand Down Expand Up @@ -550,6 +551,7 @@ export default {
outputs: data.outputs,
config_form: data.config_form,
tool_state: data.tool_state,
tool_version: data.tool_version,
errors: data.errors,
};
this.onUpdateStep(step);
Expand Down
1 change: 1 addition & 0 deletions client/src/stores/workflowStepStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export interface NewStep {
position?: StepPosition;
post_job_actions?: PostJobActions;
tool_state: Record<string, unknown>;
tool_version?: string;
tooltip?: string;
type: "tool" | "data_input" | "data_collection_input" | "subworkflow" | "parameter_input" | "pause";
uuid?: string;
Expand Down
11 changes: 5 additions & 6 deletions lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,12 +1075,9 @@ def do_inputs(inputs, values, prefix, step, other_values=None):
step_dict["label"] = f"Unknown Tool with id '{e.tool_id}'"
step_dicts.append(step_dict)
continue
if step.type == "tool" or step.type is None:
tool = trans.app.toolbox.get_tool(step.tool_id)
if tool:
step_dict["label"] = step.label or tool.name
else:
step_dict["label"] = f"Unknown Tool with id '{step.tool_id}'"
if step.type == "tool":
tool = trans.app.toolbox.get_tool(step.tool_id, step.tool_version)
step_dict["label"] = step.label or tool.name
step_dict["inputs"] = do_inputs(tool.inputs, step.state.inputs, "", step)
elif step.type == "subworkflow":
step_dict["label"] = step.label or (step.subworkflow.name if step.subworkflow else "Missing workflow.")
Expand Down Expand Up @@ -1158,6 +1155,8 @@ def _workflow_to_dict_editor(self, trans, stored, workflow, tooltip=True, is_sub
input_connections_type = {}
multiple_input = {} # Boolean value indicating if this can be multiple
if isinstance(module, ToolModule) and module.tool:
# Serialize tool version
step_dict["tool_version"] = module.tool.version
# Determine full (prefixed) names of valid input datasets
data_input_names = {}

Expand Down
5 changes: 4 additions & 1 deletion lib/galaxy/webapps/galaxy/api/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,17 @@ def build_module(self, trans: GalaxyWebTransaction, payload=None):
module_state: Dict[str, Any] = {}
populate_state(trans, module.get_inputs(), inputs, module_state, check=False)
module.recover_state(module_state, from_tool_form=True)
return {
step_dict = {
"name": module.get_name(),
"tool_state": module.get_state(),
"content_id": module.get_content_id(),
"inputs": module.get_all_inputs(connectable_only=True),
"outputs": module.get_all_outputs(),
"config_form": module.get_config_form(),
}
if payload["type"] == "tool":
step_dict["tool_version"] = module.get_version()
return step_dict

@expose_api
def get_tool_predictions(self, trans: ProvidesUserContext, payload, **kwd):
Expand Down
8 changes: 8 additions & 0 deletions lib/galaxy_test/selenium/test_workflow_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ def test_editor_tool_upgrade(self):
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
assert workflow["steps"]["0"]["tool_version"] == "0.2"
editor.node._(label="multiple_versions").wait_for_and_click()
editor.tool_version_button.wait_for_and_click()
assert self.select_dropdown_item("Switch to 0.1+galaxy6"), "Switch to tool version dropdown item not found"
self.screenshot("workflow_editor_version_downgrade")
self.sleep_for(self.wait_types.UX_RENDER)
self.assert_workflow_has_changes_and_save()
workflow = self.workflow_populator.download_workflow(workflow_id)
assert workflow["steps"]["0"]["tool_version"] == "0.1+galaxy6"

@selenium_test
def test_editor_tool_upgrade_message(self):
Expand Down
Loading