Skip to content

Commit

Permalink
Remove DummyDataset
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Feb 18, 2016
1 parent 25c6eda commit 89759a0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 29 deletions.
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/tool/tool-form-workflow.js
Expand Up @@ -50,7 +50,7 @@ define(['utils/utils', 'mvc/tool/tool-form-base'],
if ( [ 'data', 'data_collection' ].indexOf( input.type ) != -1 ) {
input.type = 'hidden';
input.info = 'Data input \'' + input.name + '\' (' + Utils.textify( input.extensions && input.extensions.toString() ) + ')';
input.value = null;
input.value = {'__class__': 'RuntimeValue'};
} else {
input.collapsible_value = {'__class__': 'RuntimeValue'};
input.is_workflow = ( input.options && input.options.length == 0 ) ||
Expand Down
4 changes: 1 addition & 3 deletions lib/galaxy/tools/parameters/__init__.py
Expand Up @@ -2,7 +2,7 @@
Classes encapsulating Galaxy tool parameters.
"""
import re
from basic import DummyDataset, RuntimeValue
from basic import RuntimeValue
from grouping import Conditional, Repeat, Section, UploadDataset
from galaxy.util import string_as_bool
from galaxy.util.json import dumps, json_fix, loads
Expand Down Expand Up @@ -67,8 +67,6 @@ def check_param( trans, param, incoming_value, param_values ):
error = None
try:
if trans.workflow_building_mode:
if isinstance( value, DummyDataset ):
return [ None, None ]
if isinstance( value, RuntimeValue ):
return [ { '__class__' : 'RuntimeValue' }, None ]
if isinstance( value, dict ):
Expand Down
12 changes: 4 additions & 8 deletions lib/galaxy/tools/parameters/basic.py
Expand Up @@ -1640,10 +1640,6 @@ def to_dict( self, trans, view='collection', value_mapper=None, other_values={}
return d


class DummyDataset( object ):
pass


class BaseDataToolParameter( ToolParameter ):

def __init__( self, tool, input_source, trans ):
Expand Down Expand Up @@ -1899,7 +1895,7 @@ def get_initial_value_from_history_prevent_repeats( self, trans, other_values, a
"""
# Can't look at history in workflow mode. Tool shed has no histories.
if trans.workflow_building_mode or trans.app.name == 'tool_shed':
return DummyDataset()
return RuntimeValue()
history = self._get_history( trans )
dataset_matcher = DatasetMatcher( trans, self, None, other_values )
if self.optional:
Expand Down Expand Up @@ -2003,9 +1999,9 @@ def to_string( self, value, app ):
return value
elif isinstance( value, int ):
return str( value )
elif isinstance( value, DummyDataset ):
elif isinstance( value, RuntimeValue ):
return None
elif isinstance( value, list) and len(value) > 0 and isinstance( value[0], DummyDataset):
elif isinstance( value, list) and len(value) > 0 and isinstance( value[0], RuntimeValue):
return None
elif isinstance( value, list ):
return ",".join( [ str( self.to_string( val, app ) ) for val in value ] )
Expand Down Expand Up @@ -2325,7 +2321,7 @@ def from_html( self, value, trans, other_values={} ):
def to_string( self, value, app ):
if value is None or isinstance( value, basestring ):
return value
elif isinstance( value, DummyDataset ):
elif isinstance( value, RuntimeValue ):
return None
try:
if isinstance( value, galaxy.model.DatasetCollectionElement ):
Expand Down
21 changes: 6 additions & 15 deletions lib/galaxy/workflow/modules.py
Expand Up @@ -21,7 +21,6 @@
parameter_types,
DataCollectionToolParameter,
DataToolParameter,
DummyDataset,
RuntimeValue,
)
from galaxy.tools.parameters.wrapped import make_dict_copy
Expand Down Expand Up @@ -1049,11 +1048,9 @@ def encode_runtime_state( self, trans, state ):
return encoded

def update_state( self, incoming ):
""" Update the current state of the module against the user supplied
parameters in the dict-like object `incoming`.
"""
self.label = incoming.get( 'label' )
self.state.inputs = copy.deepcopy( incoming )
print self.state.inputs

def check_and_update_state( self ):
inputs = self.state.inputs
Expand All @@ -1065,14 +1062,8 @@ def compute_runtime_state( self, trans, step_updates=None ):
state = self.state
self.runtime_post_job_actions = {}
if step_updates:
# Get the tool
tool = self.tool
# Get old errors
old_errors = state.inputs.pop( "__errors__", {} )
# Update the state
self.runtime_post_job_actions = step_updates.get(RUNTIME_POST_JOB_ACTIONS_KEY, {})
step_errors = tool.update_state( trans, tool.inputs, state.inputs, step_updates,
update_only=True, old_errors=old_errors )
self.tool.populate_state( trans, self.tool.inputs, state.inputs, step_updates, step_errors )
step_metadata_runtime_state = self.__step_meta_runtime_state()
if step_metadata_runtime_state:
state.inputs[ RUNTIME_STEP_META_STATE_KEY ] = step_metadata_runtime_state
Expand Down Expand Up @@ -1211,20 +1202,20 @@ def add_dummy_datasets( self, connections=None):
dict( ( conn.input_name, conn ) for conn in connections )
else:
input_connections_by_name = {}
# Any connected input needs to have value DummyDataset (these
# Any connected input needs to have value RuntimeValue (these
# are not persisted so we need to do it every time)

def callback( input, value, prefixed_name, prefixed_label ):
replacement = None
if isinstance( input, DataToolParameter ):
if connections is None or prefixed_name in input_connections_by_name:
if input.multiple:
replacement = [] if not connections else [DummyDataset() for conn in connections]
replacement = [] if not connections else [RuntimeValue() for conn in connections]
else:
replacement = DummyDataset()
replacement = RuntimeValue()
elif isinstance( input, DataCollectionToolParameter ):
if connections is None or prefixed_name in input_connections_by_name:
replacement = DummyDataset()
replacement = RuntimeValue()
return replacement

visit_input_values( self.tool.inputs, self.state.inputs, callback )
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/tool/tool-form-workflow.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 89759a0

Please sign in to comment.