mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-29 17:42:12 +08:00
Merge pull request #1097 from jmchilton/cwl_refactoring
Small Tool and Workflow Cleanups from CWL Work.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ):
|
||||
|
||||
Reference in New Issue
Block a user