Skip to content

Commit

Permalink
Improve initial value injection, adjust former run form
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Aug 12, 2016
1 parent 87038d2 commit e614a6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
30 changes: 13 additions & 17 deletions lib/galaxy/workflow/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from galaxy.tools.parameters.wrapped import make_dict_copy
from galaxy.tools import DefaultToolState
from galaxy.tools import ToolInputsNotReadyException
from galaxy.util import odict, listify
from galaxy.util import odict
from galaxy.util.bunch import Bunch
from galaxy.web.framework import formbuilder
from tool_shed.util import common_util
Expand Down Expand Up @@ -1152,28 +1152,24 @@ def _handle_post_job_actions( self, step, job, replacement_dict ):

def add_dummy_datasets( self, connections=None, steps=None ):
if connections:
# Store onnections by input name
# Store connections by input name
input_connections_by_name = dict( ( conn.input_name, conn ) for conn in connections )
else:
input_connections_by_name = {}

# Any connected input needs to have value RuntimeValue (these
# are not persisted so we need to do it every time)
# Any input needs to have value RuntimeValue or obtain the value from connected steps
def callback( input, prefixed_name, context, **kwargs ):
if isinstance( input, DataToolParameter ) or isinstance( input, DataCollectionToolParameter ):
if self.trans.workflow_building_mode is workflow_building_modes.USE_HISTORY:
if connections is None or prefixed_name in input_connections_by_name:
if steps:
connection = input_connections_by_name[ prefixed_name ]
output_step = next( output_step for output_step in steps if connection.output_step_id == output_step.id )
if output_step.type.startswith( 'data' ):
output_inputs = output_step.module.get_runtime_inputs( connections=connections )
output_value = output_inputs[ 'input' ].get_initial_value( self.trans, context )
if isinstance( input, DataToolParameter ):
for v in listify( output_value ):
if isinstance( v, self.trans.app.model.HistoryDatasetCollectionAssociation ):
return v.to_hda_representative()
return output_value
if connections is not None and steps is not None and self.trans.workflow_building_mode is workflow_building_modes.USE_HISTORY:
if prefixed_name in input_connections_by_name:
connection = input_connections_by_name[ prefixed_name ]
output_step = next( output_step for output_step in steps if connection.output_step_id == output_step.id )
if output_step.type.startswith( 'data' ):
output_inputs = output_step.module.get_runtime_inputs( connections=connections )
output_value = output_inputs[ 'input' ].get_initial_value( self.trans, context )
if isinstance( input, DataToolParameter ) and isinstance( output_value, self.trans.app.model.HistoryDatasetCollectionAssociation ):
return output_value.to_hda_representative()
return output_value
return RuntimeValue()
else:
return input.get_initial_value( self.trans, context )
Expand Down
12 changes: 1 addition & 11 deletions templates/webapps/galaxy/workflow/run.mako
Original file line number Diff line number Diff line change
Expand Up @@ -699,17 +699,7 @@ import base64
% endif
</div>
<div class="toolFormBody">
<%
# Filter possible inputs to data types that are valid for subsequent steps
type_filter = []
for oc in step.output_connections:
for ic in oc.input_step.module.get_data_inputs():
if 'extensions' in ic and ic['name'] == oc.input_name:
type_filter += ic['extensions']
if not type_filter:
type_filter = ['data']
%>
${do_inputs( module.get_runtime_inputs(filter_set=type_filter), step.state.inputs, errors.get( step.id, dict() ), "", step, None, used_accumulator )}
${do_inputs( module.get_runtime_inputs( connections=step.output_connections ), step.state.inputs, errors.get( step.id, dict() ), "", step, None, used_accumulator )}
</div>
</div>
%endif
Expand Down

0 comments on commit e614a6e

Please sign in to comment.