From 20f01fcb8faa36794ccafb9dfbd05f63ddf34d24 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Fri, 28 Oct 2011 16:13:21 -0400 Subject: [PATCH] Fixes for finding tools installed from a tool shed when building workflows from the current history or running workflows, and the workflow in question references tools using the old tool_id. --- lib/galaxy/web/controllers/workflow.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/web/controllers/workflow.py b/lib/galaxy/web/controllers/workflow.py index 739cd975eb4..f1efc758a36 100644 --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -1296,7 +1296,16 @@ class WorkflowController( BaseUIController, Sharable, UsesStoredWorkflow, UsesAn for job_id in job_ids: assert job_id in jobs_by_id, "Attempt to create workflow with job not connected to current history" job = jobs_by_id[ job_id ] - tool = trans.app.toolbox.tools_by_id[ job.tool_id ] + try: + tool = trans.app.toolbox.tools_by_id[ job.tool_id ] + except KeyError, e: + # Handle the case where the workflow requires a tool not available in the local Galaxy instance. + # The id value of tools installed from a Galaxy tool shed is a guid, but these tool's old_id + # attribute should contain what we're looking for. + for available_tool_id, available_tool in trans.app.toolbox.tools_by_id.items(): + if job.tool_id == available_tool.old_id: + tool = available_tool + break param_values = job.get_param_values( trans.app ) associations = cleanup_param_values( tool.inputs, param_values ) # Doing it this way breaks dynamic parameters, backed out temporarily. @@ -1463,7 +1472,16 @@ class WorkflowController( BaseUIController, Sharable, UsesStoredWorkflow, UsesAn # Execute module job = None if step.type == 'tool' or step.type is None: - tool = trans.app.toolbox.tools_by_id[ step.tool_id ] + try: + tool = trans.app.toolbox.tools_by_id[ step.tool_id ] + except KeyError, e: + # Handle the case where the workflow requires a tool not available in the local Galaxy instance. + # The id value of tools installed from a Galaxy tool shed is a guid, but these tool's old_id + # attribute should contain what we're looking for. + for available_tool_id, available_tool in trans.app.toolbox.tools_by_id.items(): + if step.tool_id == available_tool.old_id: + tool = available_tool + break input_values = step.state.inputs # Connect up def callback( input, value, prefixed_name, prefixed_label ):