diff --git a/lib/galaxy/managers/workflows.py b/lib/galaxy/managers/workflows.py index e889075c615..aa9d0376bea 100644 --- a/lib/galaxy/managers/workflows.py +++ b/lib/galaxy/managers/workflows.py @@ -124,6 +124,9 @@ CreatedWorkflow = namedtuple("CreatedWorkflow", ["stored_workflow", "missing_too class WorkflowContentsManager(UsesAnnotations): + def __init__(self, app): + self.app = app + def build_workflow_from_dict( self, trans, diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 6a9467f2a6b..d9b6db562ed 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -613,10 +613,6 @@ class Tool( object, Dictifiable ): """ Read tool configuration from the element `root` and fill in `self`. """ - # Get the (user visible) name of the tool - self.name = tool_source.parse_name() - if not self.name: - raise Exception( "Missing tool 'name'" ) # Get the UNIQUE id for the tool self.old_id = tool_source.parse_id() if guid is None: @@ -625,6 +621,12 @@ class Tool( object, Dictifiable ): self.id = guid if not self.id: raise Exception( "Missing tool 'id'" ) + + # Get the (user visible) name of the tool + self.name = tool_source.parse_name() + if not self.name: + raise Exception( "Missing tool 'name'" ) + self.version = tool_source.parse_version() if not self.version: # For backward compatibility, some tools may not have versions yet. diff --git a/lib/galaxy/web/base/controller.py b/lib/galaxy/web/base/controller.py index f9be1af8978..1aa94f23fd8 100644 --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -1099,7 +1099,7 @@ class UsesStoredWorkflowMixin( SharableItemSecurityMixin, UsesAnnotations ): Creates a workflow from a dict. Created workflow is stored in the database and returned. """ # TODO: replace this method with direct access to manager. - workflow_contents_manager = workflows.WorkflowContentsManager() + workflow_contents_manager = workflows.WorkflowContentsManager( self.app ) created_workflow = workflow_contents_manager.build_workflow_from_dict( trans, data, diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index e83528bfbc2..4e7107d44c3 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -30,7 +30,7 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn super( WorkflowsAPIController, self ).__init__( app ) self.history_manager = histories.HistoryManager( app ) self.workflow_manager = workflows.WorkflowsManager( app ) - self.workflow_contents_manager = workflows.WorkflowContentsManager() + self.workflow_contents_manager = workflows.WorkflowContentsManager( app ) @expose_api def index(self, trans, **kwd): @@ -300,8 +300,7 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn """ stored_workflow = self.__get_stored_workflow( trans, id ) if 'workflow' in payload: - workflow_contents_manager = workflows.WorkflowContentsManager() - workflow, errors = workflow_contents_manager.update_workflow_from_dict( + workflow, errors = self.workflow_contents_manager.update_workflow_from_dict( trans, stored_workflow, payload['workflow'], diff --git a/lib/galaxy/workflow/extract.py b/lib/galaxy/workflow/extract.py index 39c2e57fc2e..d2ff8f163fe 100644 --- a/lib/galaxy/workflow/extract.py +++ b/lib/galaxy/workflow/extract.py @@ -106,6 +106,7 @@ def extract_steps( trans, history=None, job_ids=None, dataset_ids=None, dataset_ step = model.WorkflowStep() step.type = 'tool' step.tool_id = job.tool_id + step.tool_version = job.tool_version step.tool_inputs = tool_inputs # NOTE: We shouldn't need to do two passes here since only # an earlier job can be used as an input to a later diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index c22b9ee10bd..5670084cb19 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -222,6 +222,7 @@ class SimpleWorkflowModule( WorkflowModule ): def save_to_step( self, step ): step.type = self.type step.tool_id = None + step.tool_version = None step.tool_inputs = self.state def get_state( self, secure=True ):