Skip to content

Commit

Permalink
Merge pull request #1097 from jmchilton/cwl_refactoring
Browse files Browse the repository at this point in the history
Small Tool and Workflow Cleanups from CWL Work.
  • Loading branch information
martenson committed Nov 20, 2015
2 parents 05ed245 + 0030f4c commit 7bb88b3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions lib/galaxy/managers/workflows.py
Expand Up @@ -124,6 +124,9 @@ def build_invocations_query( self, trans, decoded_stored_workflow_id ):

class WorkflowContentsManager(UsesAnnotations):

def __init__(self, app):
self.app = app

def build_workflow_from_dict(
self,
trans,
Expand Down
10 changes: 6 additions & 4 deletions lib/galaxy/tools/__init__.py
Expand Up @@ -613,10 +613,6 @@ def parse( self, tool_source, guid=None ):
"""
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:
Expand All @@ -625,6 +621,12 @@ def parse( self, tool_source, guid=None ):
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.
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/web/base/controller.py
Expand Up @@ -1099,7 +1099,7 @@ def _workflow_from_dict( self, trans, data, source=None, add_to_menu=False, publ
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,
Expand Down
5 changes: 2 additions & 3 deletions lib/galaxy/webapps/galaxy/api/workflows.py
Expand Up @@ -30,7 +30,7 @@ def __init__( self, app ):
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):
Expand Down Expand Up @@ -300,8 +300,7 @@ def update( self, trans, id, payload, **kwds ):
"""
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'],
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/workflow/extract.py
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/workflow/modules.py
Expand Up @@ -222,6 +222,7 @@ def default_state( Class ):
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 ):
Expand Down

0 comments on commit 7bb88b3

Please sign in to comment.