commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/aa867e3d2bd9/ Changeset: aa867e3d2bd9 User: jmchilton Date: 2014-09-18 13:50:52+00:00 Summary: More complete testing of workflow import and export. Test some new aspects of step description inputs. Affected #: 3 files diff -r 76be361f50b29515226f94bd2a2e01f0d9ff413b -r aa867e3d2bd96b38eed23bc4bcacfa77345b017e test/api/test_workflow_1.ga --- a/test/api/test_workflow_1.ga +++ b/test/api/test_workflow_1.ga @@ -5,12 +5,12 @@ "name": "TestWorkflow1", "steps": { "0": { - "annotation": "", + "annotation": "input1 description", "id": 0, "input_connections": {}, "inputs": [ { - "description": "", + "description": "input1 description", "name": "WorkflowInput1" } ], diff -r 76be361f50b29515226f94bd2a2e01f0d9ff413b -r aa867e3d2bd96b38eed23bc4bcacfa77345b017e test/api/test_workflow_with_runtime_input.ga --- /dev/null +++ b/test/api/test_workflow_with_runtime_input.ga @@ -0,0 +1,66 @@ +{ + "a_galaxy_workflow": "true", + "annotation": "", + "format-version": "0.1", + "name": "test_workflow_with_runtime_input", + "steps": { + "0": { + "annotation": "", + "id": 0, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "Input Dataset" + } + ], + "name": "Input dataset", + "outputs": [], + "position": { + "left": 248.49653673171997, + "top": 154.98959398269653 + }, + "tool_errors": null, + "tool_id": null, + "tool_state": "{\"name\": \"Input Dataset\"}", + "tool_version": null, + "type": "data_input", + "user_outputs": [] + }, + "1": { + "annotation": "", + "id": 1, + "input_connections": { + "input": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [ + { + "description": "runtime parameter for tool Select random lines", + "name": "num_lines" + } + ], + "name": "Select random lines", + "outputs": [ + { + "name": "out_file1", + "type": "input" + } + ], + "position": { + "left": 514.0208587646484, + "top": 116.01736450195312 + }, + "post_job_actions": {}, + "tool_errors": null, + "tool_id": "random_lines1", + "tool_state": "{\"input\": \"null\", \"seed_source\": \"{\\\"__current_case__\\\": 0, \\\"seed_source_selector\\\": \\\"no_seed\\\"}\", \"__rerun_remap_job_id__\": null, \"num_lines\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"__page__\": 0}", + "tool_version": "2.0.1", + "type": "tool", + "user_outputs": [] + } + }, + "uuid": "ebb0e189-e1ae-4f08-a0aa-97d8674f9f76" +} \ No newline at end of file diff -r 76be361f50b29515226f94bd2a2e01f0d9ff413b -r aa867e3d2bd96b38eed23bc4bcacfa77345b017e test/api/test_workflows.py --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -105,6 +105,17 @@ assert len( downloaded_workflow[ "steps" ] ) == 3 first_input = downloaded_workflow[ "steps" ][ "0" ][ "inputs" ][ 0 ] assert first_input[ "name" ] == "WorkflowInput1" + assert first_input[ "description" ] == "input1 description" + + def test_import_export_with_runtime_inputs( self ): + workflow = self.workflow_populator.load_workflow_from_resource( name="test_workflow_with_runtime_input" ) + workflow_id = self.workflow_populator.create_workflow( workflow ) + download_response = self._get( "workflows/%s/download" % workflow_id ) + downloaded_workflow = download_response.json() + assert len( downloaded_workflow[ "steps" ] ) == 2 + runtime_input = downloaded_workflow[ "steps" ][ "1" ][ "inputs" ][ 0 ] + assert runtime_input[ "description" ].startswith( "runtime parameter for tool" ) + assert runtime_input[ "name" ] == "num_lines" @skip_without_tool( "cat1" ) def test_run_workflow_by_index( self ): https://bitbucket.org/galaxy/galaxy-central/commits/bd682aec7471/ Changeset: bd682aec7471 User: jmchilton Date: 2014-09-18 13:50:52+00:00 Summary: Refactor logic for generating dictified runtime inputs for workflow steps into workflow module. Continuing the pattern - this is one less place where consumers of workflows modules need to explicitly dispatch on type and should make it easier and clear what needs to be defined when adding new workflow modules. This also reduces the cyclomatic complexity of the large _workflow_to_dict method. Previous commit provides test coverage verifying this doesn't modify the behavior of workflow extraction. Affected #: 2 files diff -r aa867e3d2bd96b38eed23bc4bcacfa77345b017e -r bd682aec7471f0e76423ae13eee6fd829cf1eaf8 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -41,7 +41,7 @@ from galaxy.managers import tags from galaxy.managers import base as managers_base from galaxy.datatypes.metadata import FileParameter -from galaxy.tools.parameters import RuntimeValue, visit_input_values +from galaxy.tools.parameters import visit_input_values from galaxy.tools.parameters.basic import DataToolParameter from galaxy.tools.parameters.basic import DataCollectionToolParameter from galaxy.util.json import dumps @@ -1738,25 +1738,7 @@ action_arguments = pja.action_arguments ) step_dict[ 'post_job_actions' ] = pja_dict # Data inputs - step_dict['inputs'] = [] - if module.type == "data_input": - # Get input dataset name; default to 'Input Dataset' - name = module.state.get( 'name', 'Input Dataset') - step_dict['inputs'].append( { "name" : name, "description" : annotation_str } ) - elif module.type == "data_collection_input": - name = module.state.get( 'name', 'Input Dataset Collection' ) - step_dict['inputs'].append( { "name" : name, "description" : annotation_str } ) - else: - # Step is a tool and may have runtime inputs. - for name, val in module.state.inputs.items(): - input_type = type( val ) - if input_type == RuntimeValue: - step_dict['inputs'].append( { "name" : name, "description" : "runtime parameter for tool %s" % module.get_name() } ) - elif input_type == dict: - # Input type is described by a dict, e.g. indexed parameters. - for partval in val.values(): - if type( partval ) == RuntimeValue: - step_dict['inputs'].append( { "name" : name, "description" : "runtime parameter for tool %s" % module.get_name() } ) + step_dict['inputs'] = module.get_runtime_input_dicts( annotation_str ) # User outputs step_dict['user_outputs'] = [] """ diff -r aa867e3d2bd96b38eed23bc4bcacfa77345b017e -r bd682aec7471f0e76423ae13eee6fd829cf1eaf8 lib/galaxy/workflow/modules.py --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -98,11 +98,16 @@ return None def get_data_inputs( self ): + """ Get configure time data input descriptions. """ return [] def get_data_outputs( self ): return [] + def get_runtime_input_dicts( self, step_annotation ): + """ Get runtime inputs (inputs and parameters) as simple dictionary. """ + return [] + def get_config_form( self ): """ Render form that is embedded in workflow editor for modifying the step state of a node. @@ -194,6 +199,10 @@ """ raise TypeError( "Abstract method" ) + def get_runtime_input_dicts( self, step_annotation ): + name = self.state.get( "name", self.default_name ) + return [ dict( name=name, description=step_annotation ) ] + def recover_state( self, state, **kwds ): """ Recover state `dict` from simple dictionary describing configuration state (potentially from persisted step state). @@ -529,6 +538,20 @@ data_outputs.append( dict( name=name, extensions=formats ) ) return data_outputs + def get_runtime_input_dicts( self, step_annotation ): + # Step is a tool and may have runtime inputs. + input_dicts = [] + for name, val in self.state.inputs.items(): + input_type = type( val ) + if input_type == RuntimeValue: + input_dicts.append( { "name": name, "description": "runtime parameter for tool %s" % self.get_name() } ) + elif input_type == dict: + # Input type is described by a dict, e.g. indexed parameters. + for partval in val.values(): + if type( partval ) == RuntimeValue: + input_dicts.append( { "name": name, "description": "runtime parameter for tool %s" % self.get_name() } ) + return input_dicts + def get_post_job_actions( self ): return self.post_job_actions Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org