commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/73bb36c4ee3b/ changeset: 73bb36c4ee3b branch: next-stable user: dan date: 2013-02-02 00:13:05 summary: Fix for workflow parameters. affected #: 2 files diff -r 0ded962ca5d04f86bf61087ab0d5df7cdce41ce9 -r 73bb36c4ee3b34c3ca32ed830b4f91df79b971c5 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -42,6 +42,8 @@ log = logging.getLogger( __name__ ) +WORKFLOW_PARAMETER_REGULAR_EXPRESSION = re.compile( '''\$\{.+?\}''' ) + # These determine stdio-based error levels from matching on regular expressions # and exit codes. They are meant to be used comparatively, such as showing # that warning < fatal. This is really meant to just be an enum. @@ -2123,16 +2125,16 @@ return params_to_strings( self.inputs, params, app ) def params_from_strings( self, params, app, ignore_errors=False ): return params_from_strings( self.inputs, params, app, ignore_errors ) - def check_and_update_param_values( self, values, trans, update_values=True ): + def check_and_update_param_values( self, values, trans, update_values=True, allow_workflow_parameters=False ): """ Check that all parameters have values, and fill in with default values where necessary. This could be called after loading values from a database in case new parameters have been added. """ messages = {} - self.check_and_update_param_values_helper( self.inputs, values, trans, messages, update_values=update_values ) + self.check_and_update_param_values_helper( self.inputs, values, trans, messages, update_values=update_values, allow_workflow_parameters=allow_workflow_parameters ) return messages - def check_and_update_param_values_helper( self, inputs, values, trans, messages, context=None, prefix="", update_values=True ): + def check_and_update_param_values_helper( self, inputs, values, trans, messages, context=None, prefix="", update_values=True, allow_workflow_parameters=False ): """ Recursive helper for `check_and_update_param_values_helper` """ @@ -2177,8 +2179,13 @@ else: # Regular tool parameter, no recursion needed try: + check_param = True + if allow_workflow_parameters and isinstance( values[ input.name ], basestring ): + if WORKFLOW_PARAMETER_REGULAR_EXPRESSION.search( values[ input.name ] ): + check_param = False #this will fail when a parameter's type has changed to a non-compatible one: e.g. conditional group changed to dataset input - input.value_from_basic( input.value_to_basic( values[ input.name ], trans.app ), trans.app, ignore_errors=False ) + if check_param: + input.value_from_basic( input.value_to_basic( values[ input.name ], trans.app ), trans.app, ignore_errors=False ) except: messages[ input.name ] = "Value no longer valid for '%s%s', replaced with default" % ( prefix, input.label ) if update_values: diff -r 0ded962ca5d04f86bf61087ab0d5df7cdce41ce9 -r 73bb36c4ee3b34c3ca32ed830b4f91df79b971c5 lib/galaxy/workflow/modules.py --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -352,7 +352,7 @@ self.errors = errors or None def check_and_update_state( self ): - return self.tool.check_and_update_param_values( self.state.inputs, self.trans ) + return self.tool.check_and_update_param_values( self.state.inputs, self.trans, allow_workflow_parameters=True ) def add_dummy_datasets( self, connections=None): if connections: https://bitbucket.org/galaxy/galaxy-central/commits/bb6a6347e50b/ changeset: bb6a6347e50b user: dan date: 2013-02-02 00:13:27 summary: Merged from next-stable affected #: 2 files diff -r 132aeb4a4b96de744d20de6f368d197d59e7b9e3 -r bb6a6347e50be301026039e157cd952462ed0683 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -42,6 +42,8 @@ log = logging.getLogger( __name__ ) +WORKFLOW_PARAMETER_REGULAR_EXPRESSION = re.compile( '''\$\{.+?\}''' ) + # These determine stdio-based error levels from matching on regular expressions # and exit codes. They are meant to be used comparatively, such as showing # that warning < fatal. This is really meant to just be an enum. @@ -2123,16 +2125,16 @@ return params_to_strings( self.inputs, params, app ) def params_from_strings( self, params, app, ignore_errors=False ): return params_from_strings( self.inputs, params, app, ignore_errors ) - def check_and_update_param_values( self, values, trans, update_values=True ): + def check_and_update_param_values( self, values, trans, update_values=True, allow_workflow_parameters=False ): """ Check that all parameters have values, and fill in with default values where necessary. This could be called after loading values from a database in case new parameters have been added. """ messages = {} - self.check_and_update_param_values_helper( self.inputs, values, trans, messages, update_values=update_values ) + self.check_and_update_param_values_helper( self.inputs, values, trans, messages, update_values=update_values, allow_workflow_parameters=allow_workflow_parameters ) return messages - def check_and_update_param_values_helper( self, inputs, values, trans, messages, context=None, prefix="", update_values=True ): + def check_and_update_param_values_helper( self, inputs, values, trans, messages, context=None, prefix="", update_values=True, allow_workflow_parameters=False ): """ Recursive helper for `check_and_update_param_values_helper` """ @@ -2177,8 +2179,13 @@ else: # Regular tool parameter, no recursion needed try: + check_param = True + if allow_workflow_parameters and isinstance( values[ input.name ], basestring ): + if WORKFLOW_PARAMETER_REGULAR_EXPRESSION.search( values[ input.name ] ): + check_param = False #this will fail when a parameter's type has changed to a non-compatible one: e.g. conditional group changed to dataset input - input.value_from_basic( input.value_to_basic( values[ input.name ], trans.app ), trans.app, ignore_errors=False ) + if check_param: + input.value_from_basic( input.value_to_basic( values[ input.name ], trans.app ), trans.app, ignore_errors=False ) except: messages[ input.name ] = "Value no longer valid for '%s%s', replaced with default" % ( prefix, input.label ) if update_values: diff -r 132aeb4a4b96de744d20de6f368d197d59e7b9e3 -r bb6a6347e50be301026039e157cd952462ed0683 lib/galaxy/workflow/modules.py --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -352,7 +352,7 @@ self.errors = errors or None def check_and_update_state( self ): - return self.tool.check_and_update_param_values( self.state.inputs, self.trans ) + return self.tool.check_and_update_param_values( self.state.inputs, self.trans, allow_workflow_parameters=True ) def add_dummy_datasets( self, connections=None): if connections: 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)
-
Bitbucket