commit/galaxy-central: 8 new changesets
8 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/5196dc5182f6/ Changeset: 5196dc5182f6 Branch: tool_api_submit User: Kyle Ellrott Date: 2013-06-27 23:23:12 Summary: Adding 'history' parameter to 'get_initial_value' method calls. This allows api based tool requests to build default parameters without having a fixed history attached to the 'trans' class Affected #: 3 files diff -r 63b58d89dedd942ad9842958476dd9d364fe1fe0 -r 5196dc5182f6595b1978cc52359f49547a4a2706 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1814,7 +1814,7 @@ # TODO: Anyway to capture tools that dynamically change their own # outputs? return True - def new_state( self, trans, all_pages=False ): + def new_state( self, trans, all_pages=False, history=None ): """ Create a new `DefaultToolState` for this tool. It will be initialized with default values for inputs. @@ -1828,16 +1828,16 @@ inputs = self.inputs else: inputs = self.inputs_by_page[ 0 ] - self.fill_in_new_state( trans, inputs, state.inputs ) + self.fill_in_new_state( trans, inputs, state.inputs, history=history ) return state - def fill_in_new_state( self, trans, inputs, state, context=None ): + def fill_in_new_state( self, trans, inputs, state, context=None, history=None ): """ Fill in a tool state dictionary with default values for all parameters in the dictionary `inputs`. Grouping elements are filled in recursively. """ context = ExpressionContext( state, context ) for input in inputs.itervalues(): - state[ input.name ] = input.get_initial_value( trans, context ) + state[ input.name ] = input.get_initial_value( trans, context, history=history ) def get_param_html_map( self, trans, page=0, other_values={} ): """ Return a dictionary containing the HTML representation of each @@ -1900,7 +1900,7 @@ state = DefaultToolState() state.decode( encoded_state, self, trans.app ) else: - state = self.new_state( trans ) + state = self.new_state( trans, history=history ) # This feels a bit like a hack. It allows forcing full processing # of inputs even when there is no state in the incoming dictionary # by providing either 'runtool_btn' (the name of the submit button diff -r 63b58d89dedd942ad9842958476dd9d364fe1fe0 -r 5196dc5182f6595b1978cc52359f49547a4a2706 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -69,13 +69,13 @@ """ return value - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): """ Return the starting value of the parameter """ return None - def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used ): + def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used, history=None ): """ Get the starting value for the parameter, but if fetching from the history, try to find a value that has not yet been used. already_used is a list of objects that @@ -83,7 +83,7 @@ if a value has already been chosen from the history. This is to support the capability to choose each dataset once """ - return self.get_initial_value(trans, context); + return self.get_initial_value(trans, context, history=history); def get_required_enctype( self ): """ @@ -204,7 +204,7 @@ return form_builder.TextArea( self.name, self.size, value ) else: return form_builder.TextField( self.name, self.size, value ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.value class IntegerToolParameter( TextToolParameter ): @@ -271,7 +271,7 @@ if not value and self.optional: return None raise err - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): if self.value: return int( self.value ) else: @@ -340,7 +340,7 @@ if not value and self.optional: return None raise err - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): try: return float( self.value ) except: @@ -383,7 +383,7 @@ return [ 'true' ] def to_python( self, value, app ): return ( value == 'True' ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.checked def to_param_dict_string( self, value, other_values={} ): if value: @@ -456,7 +456,7 @@ return value else: raise Exception( "FileToolParameter cannot be persisted" ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return None class FTPFileToolParameter( ToolParameter ): @@ -495,7 +495,7 @@ return None elif isinstance( value, unicode ) or isinstance( value, str ) or isinstance( value, list ): return value - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return None class HiddenToolParameter( ToolParameter ): @@ -516,7 +516,7 @@ self.value = elem.get( 'value' ) def get_html_field( self, trans=None, value=None, other_values={} ): return form_builder.HiddenField( self.name, self.value ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.value def get_label( self ): return None @@ -539,7 +539,7 @@ return url def get_html_field( self, trans=None, value=None, other_values={} ): return form_builder.HiddenField( self.name, self.get_value( trans ) ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.value def get_label( self ): # BaseURLToolParameters are ultimately "hidden" parameters @@ -805,7 +805,7 @@ return True # Dynamic, but all dependenceis are known and have values return False - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): # More working around dynamic options for workflow if self.need_late_validation( trans, context ): # Really the best we can do? @@ -1035,7 +1035,7 @@ options.append( ( 'c' + col, col, False ) ) return options - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): if self.default_value is not None: # dataset not ready / in workflow / etc if self.need_late_validation( trans, context ): @@ -1315,7 +1315,7 @@ rval = sanitize_param( rval ) return rval - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): def recurse_options( initial_values, options ): for option in options: if option['selected']: @@ -1503,10 +1503,10 @@ field.add_option( "Selection is Optional", 'None', False ) return field - def get_initial_value( self, trans, context ): - return self.get_initial_value_from_history_prevent_repeats(trans, context, None); + def get_initial_value( self, trans, context, history=None ): + return self.get_initial_value_from_history_prevent_repeats(trans, context, None, history=history); - def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used ): + def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used, history=None ): """ NOTE: This is wasteful since dynamic options and dataset collection happens twice (here and when generating HTML). @@ -1515,7 +1515,8 @@ if trans is None or trans.workflow_building_mode: return DummyDataset() assert trans is not None, "DataToolParameter requires a trans" - history = trans.get_history() + if history is None: + history = trans.get_history() assert history is not None, "DataToolParameter requires a history" if self.optional: return None @@ -1687,7 +1688,7 @@ DataToolParameter.__init__( self, tool, elem ) self.value = "None" - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return None def get_html_field( self, trans=None, value=None, other_values={} ): diff -r 63b58d89dedd942ad9842958476dd9d364fe1fe0 -r 5196dc5182f6595b1978cc52359f49547a4a2706 lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -34,7 +34,7 @@ into the preferred value form. """ return value - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): """ Return the initial state/value for this group """ @@ -96,7 +96,7 @@ callback( new_prefix, input, d[input.name], parent = d ) else: input.visit_inputs( new_prefix, d[input.name], callback ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): rval = [] for i in range( self.default ): rval_dict = { '__index__': i} @@ -189,14 +189,14 @@ callback( new_prefix, input, d[input.name], parent = d ) else: input.visit_inputs( new_prefix, d[input.name], callback ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): d_type = self.get_datatype( trans, context ) rval = [] for i, ( composite_name, composite_file ) in enumerate( d_type.writable_files.iteritems() ): rval_dict = {} rval_dict['__index__'] = i # create __index__ for input in self.inputs.itervalues(): - rval_dict[ input.name ] = input.get_initial_value( trans, context ) #input.value_to_basic( d[input.name], app ) + rval_dict[ input.name ] = input.get_initial_value( trans, context, history=history ) #input.value_to_basic( d[input.name], app ) rval.append( rval_dict ) return rval def get_uploaded_datasets( self, trans, context, override_name = None, override_info = None ): @@ -476,12 +476,12 @@ callback( prefix, input, value[input.name], parent = value ) else: input.visit_inputs( prefix, value[input.name], callback ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): # State for a conditional is a plain dictionary. rval = {} # Get the default value for the 'test element' and use it # to determine the current case - test_value = self.test_param.get_initial_value( trans, context ) + test_value = self.test_param.get_initial_value( trans, context, history=None ) current_case = self.get_current_case( test_value, trans ) # Store the current case in a special value rval['__current_case__'] = current_case @@ -490,7 +490,7 @@ # Fill in state for selected case child_context = ExpressionContext( rval, context ) for child_input in self.cases[current_case].inputs.itervalues(): - rval[ child_input.name ] = child_input.get_initial_value( trans, child_context ) + rval[ child_input.name ] = child_input.get_initial_value( trans, child_context, history=None ) return rval class ConditionalWhen( object ): https://bitbucket.org/galaxy/galaxy-central/commits/7ac0ed6f42d6/ Changeset: 7ac0ed6f42d6 Branch: tool_api_submit User: Kyle Ellrott Date: 2013-06-27 23:58:14 Summary: Removing stray print statement Affected #: 1 file diff -r 5196dc5182f6595b1978cc52359f49547a4a2706 -r 7ac0ed6f42d64e24f7bd851193368184a5e28def lib/galaxy/model/migrate/check.py --- a/lib/galaxy/model/migrate/check.py +++ b/lib/galaxy/model/migrate/check.py @@ -44,7 +44,6 @@ # Let this go, it could possibly work with db's we don't support log.error( "database_connection contains an unknown SQLAlchemy database dialect: %s" % dialect ) # Create engine and metadata - print url, engine_options engine = create_engine( url, **engine_options ) meta = MetaData( bind=engine ) # Try to load dataset table https://bitbucket.org/galaxy/galaxy-central/commits/371e3b451448/ Changeset: 371e3b451448 Branch: tool_api_submit User: Kyle Ellrott Date: 2013-06-28 00:52:08 Summary: The /api/tool submit can define inputs in the payload in the format {'id' : <encoded_id>, 'src' : 'hda'} Affected #: 1 file diff -r 7ac0ed6f42d64e24f7bd851193368184a5e28def -r 371e3b451448bfb7a70139faafc33072a7d2b468 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1575,6 +1575,9 @@ rval = [ trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( v ) for v in value ] elif isinstance( value, trans.app.model.HistoryDatasetAssociation ): rval = value + elif isinstance( value, dict ) and 'src' in value and 'id' in value: + if value['src'] == 'hda': + rval = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.app.security.decode_id(value['id']) ) else: rval = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( value ) if isinstance( rval, list ): https://bitbucket.org/galaxy/galaxy-central/commits/abb889f8c5b7/ Changeset: abb889f8c5b7 Branch: tool_api_submit User: Kyle Ellrott Date: 2013-07-03 22:38:40 Summary: Adding way for API based tools job submissions to copy library dataset into history Affected #: 1 file diff -r 371e3b451448bfb7a70139faafc33072a7d2b468 -r abb889f8c5b75e8b90e8a35617e95ec7c05d28e7 lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -30,10 +30,10 @@ # Read params. in_panel = util.string_as_bool( kwds.get( 'in_panel', 'True' ) ) trackster = util.string_as_bool( kwds.get( 'trackster', 'False' ) ) - + # Create return value. try: - return self.app.toolbox.to_dict( trans, in_panel=in_panel, trackster=trackster ) + return self.app.toolbox.to_dict( trans, in_panel=in_panel, trackster=trackster) except Exception, exc: log.error( 'could not convert toolbox to dictionary: %s', str( exc ), exc_info=True ) trans.response.status = 500 @@ -87,6 +87,17 @@ for k, v in payload.iteritems(): if k.startswith("files_"): inputs[k] = v + + #for inputs that are coming from the Library, copy them into the history + input_patch = {} + for k, v in inputs.iteritems(): + if isinstance(v, dict) and v.get('src', '') == 'ldda' and 'id' in v: + ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id(v['id']) ) + if trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset ): + input_patch[k] = ldda.to_history_dataset_association(target_history, add_to_history=True) + + for k, v in input_patch.iteritems(): + inputs[k] = v # HACK: add run button so that tool.handle_input will run tool. inputs['runtool_btn'] = 'Execute' https://bitbucket.org/galaxy/galaxy-central/commits/d370b6ba1443/ Changeset: d370b6ba1443 User: Kyle Ellrott Date: 2013-06-27 23:23:12 Summary: Adding 'history' parameter to 'get_initial_value' method calls. This allows api based tool requests to build default parameters without having a fixed history attached to the 'trans' class Affected #: 3 files diff -r 44214ff2a8801dea8714b6cfc7f2d7bd6545e229 -r d370b6ba1443adf67390ae8ca7b8d71a9746b3f6 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1852,7 +1852,7 @@ # TODO: Anyway to capture tools that dynamically change their own # outputs? return True - def new_state( self, trans, all_pages=False ): + def new_state( self, trans, all_pages=False, history=None ): """ Create a new `DefaultToolState` for this tool. It will be initialized with default values for inputs. @@ -1866,16 +1866,16 @@ inputs = self.inputs else: inputs = self.inputs_by_page[ 0 ] - self.fill_in_new_state( trans, inputs, state.inputs ) + self.fill_in_new_state( trans, inputs, state.inputs, history=history ) return state - def fill_in_new_state( self, trans, inputs, state, context=None ): + def fill_in_new_state( self, trans, inputs, state, context=None, history=None ): """ Fill in a tool state dictionary with default values for all parameters in the dictionary `inputs`. Grouping elements are filled in recursively. """ context = ExpressionContext( state, context ) for input in inputs.itervalues(): - state[ input.name ] = input.get_initial_value( trans, context ) + state[ input.name ] = input.get_initial_value( trans, context, history=history ) def get_param_html_map( self, trans, page=0, other_values={} ): """ Return a dictionary containing the HTML representation of each @@ -1938,7 +1938,7 @@ state = DefaultToolState() state.decode( encoded_state, self, trans.app ) else: - state = self.new_state( trans ) + state = self.new_state( trans, history=history ) # This feels a bit like a hack. It allows forcing full processing # of inputs even when there is no state in the incoming dictionary # by providing either 'runtool_btn' (the name of the submit button diff -r 44214ff2a8801dea8714b6cfc7f2d7bd6545e229 -r d370b6ba1443adf67390ae8ca7b8d71a9746b3f6 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -72,13 +72,13 @@ """ return value - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): """ Return the starting value of the parameter """ return None - def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used ): + def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used, history=None ): """ Get the starting value for the parameter, but if fetching from the history, try to find a value that has not yet been used. already_used is a list of objects that @@ -86,7 +86,7 @@ if a value has already been chosen from the history. This is to support the capability to choose each dataset once """ - return self.get_initial_value(trans, context); + return self.get_initial_value(trans, context, history=history); def get_required_enctype( self ): """ @@ -216,7 +216,7 @@ return form_builder.TextArea( self.name, self.size, value ) else: return form_builder.TextField( self.name, self.size, value ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.value class IntegerToolParameter( TextToolParameter ): @@ -286,7 +286,7 @@ if not value and self.optional: return None raise err - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): if self.value: return int( self.value ) else: @@ -358,7 +358,7 @@ if not value and self.optional: return None raise err - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): try: return float( self.value ) except: @@ -401,7 +401,7 @@ return [ 'true' ] def to_python( self, value, app ): return ( value == 'True' ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.checked def to_param_dict_string( self, value, other_values={} ): if value: @@ -474,7 +474,7 @@ return value else: raise Exception( "FileToolParameter cannot be persisted" ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return None class FTPFileToolParameter( ToolParameter ): @@ -513,7 +513,7 @@ return None elif isinstance( value, unicode ) or isinstance( value, str ) or isinstance( value, list ): return value - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return None class HiddenToolParameter( ToolParameter ): @@ -534,7 +534,7 @@ self.value = elem.get( 'value' ) def get_html_field( self, trans=None, value=None, other_values={} ): return form_builder.HiddenField( self.name, self.value ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.value def get_label( self ): return None @@ -557,7 +557,7 @@ return url def get_html_field( self, trans=None, value=None, other_values={} ): return form_builder.HiddenField( self.name, self.get_value( trans ) ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return self.value def get_label( self ): # BaseURLToolParameters are ultimately "hidden" parameters @@ -826,7 +826,7 @@ return True # Dynamic, but all dependenceis are known and have values return False - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): # More working around dynamic options for workflow if self.need_late_validation( trans, context ): # Really the best we can do? @@ -1074,7 +1074,7 @@ options.append( ( 'c' + col, col, False ) ) return options - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): if self.default_value is not None: # dataset not ready / in workflow / etc if self.need_late_validation( trans, context ): @@ -1353,8 +1353,7 @@ else: rval = sanitize_param( rval ) return rval - - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): def recurse_options( initial_values, options ): for option in options: if option['selected']: @@ -1542,10 +1541,10 @@ field.add_option( "Selection is Optional", 'None', False ) return field - def get_initial_value( self, trans, context ): - return self.get_initial_value_from_history_prevent_repeats(trans, context, None); + def get_initial_value( self, trans, context, history=None ): + return self.get_initial_value_from_history_prevent_repeats(trans, context, None, history=history); - def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used ): + def get_initial_value_from_history_prevent_repeats( self, trans, context, already_used, history=None ): """ NOTE: This is wasteful since dynamic options and dataset collection happens twice (here and when generating HTML). @@ -1554,7 +1553,8 @@ if trans is None or trans.workflow_building_mode or trans.webapp.name == 'tool_shed': return DummyDataset() assert trans is not None, "DataToolParameter requires a trans" - history = trans.get_history() + if history is None: + history = trans.get_history() assert history is not None, "DataToolParameter requires a history" if self.optional: return None @@ -1727,7 +1727,7 @@ self.value = "None" self.type = "hidden_data" - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): return None def get_html_field( self, trans=None, value=None, other_values={} ): diff -r 44214ff2a8801dea8714b6cfc7f2d7bd6545e229 -r d370b6ba1443adf67390ae8ca7b8d71a9746b3f6 lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -41,8 +41,7 @@ into the preferred value form. """ return value - - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): """ Return the initial state/value for this group """ @@ -109,7 +108,7 @@ callback( new_prefix, input, d[input.name], parent = d ) else: input.visit_inputs( new_prefix, d[input.name], callback ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): rval = [] for i in range( self.default ): rval_dict = { '__index__': i} @@ -202,14 +201,14 @@ callback( new_prefix, input, d[input.name], parent = d ) else: input.visit_inputs( new_prefix, d[input.name], callback ) - def get_initial_value( self, trans, context ): + def get_initial_value( self, trans, context, history=None ): d_type = self.get_datatype( trans, context ) rval = [] for i, ( composite_name, composite_file ) in enumerate( d_type.writable_files.iteritems() ): rval_dict = {} rval_dict['__index__'] = i # create __index__ for input in self.inputs.itervalues(): - rval_dict[ input.name ] = input.get_initial_value( trans, context ) #input.value_to_basic( d[input.name], app ) + rval_dict[ input.name ] = input.get_initial_value( trans, context, history=history ) #input.value_to_basic( d[input.name], app ) rval.append( rval_dict ) return rval def get_uploaded_datasets( self, trans, context, override_name = None, override_info = None ): @@ -489,12 +488,12 @@ callback( prefix, input, value[input.name], parent = value ) else: input.visit_inputs( prefix, value[input.name], callback ) - def get_initial_value( self, trans, context ): - # State for a conditional is a plain dictionary. + def get_initial_value( self, trans, context, history=None ): + # State for a conditional is a plain dictionary. rval = {} # Get the default value for the 'test element' and use it # to determine the current case - test_value = self.test_param.get_initial_value( trans, context ) + test_value = self.test_param.get_initial_value( trans, context, history=None ) current_case = self.get_current_case( test_value, trans ) # Store the current case in a special value rval['__current_case__'] = current_case @@ -503,7 +502,7 @@ # Fill in state for selected case child_context = ExpressionContext( rval, context ) for child_input in self.cases[current_case].inputs.itervalues(): - rval[ child_input.name ] = child_input.get_initial_value( trans, child_context ) + rval[ child_input.name ] = child_input.get_initial_value( trans, child_context, history=None ) return rval class ConditionalWhen( object ): https://bitbucket.org/galaxy/galaxy-central/commits/3e086bca9f63/ Changeset: 3e086bca9f63 User: Kyle Ellrott Date: 2013-06-28 00:52:08 Summary: The /api/tool submit can define inputs in the payload in the format {'id' : <encoded_id>, 'src' : 'hda'} Affected #: 1 file diff -r d370b6ba1443adf67390ae8ca7b8d71a9746b3f6 -r 3e086bca9f63e270da8cbd7e65feb0b22a0ae085 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1613,6 +1613,9 @@ rval = [ trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( v ) for v in value ] elif isinstance( value, trans.app.model.HistoryDatasetAssociation ): rval = value + elif isinstance( value, dict ) and 'src' in value and 'id' in value: + if value['src'] == 'hda': + rval = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.app.security.decode_id(value['id']) ) else: rval = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( value ) if isinstance( rval, list ): https://bitbucket.org/galaxy/galaxy-central/commits/48fad71361b3/ Changeset: 48fad71361b3 User: Kyle Ellrott Date: 2013-07-03 22:38:40 Summary: Adding way for API based tools job submissions to copy library dataset into history Affected #: 1 file diff -r 3e086bca9f63e270da8cbd7e65feb0b22a0ae085 -r 48fad71361b3075c85c7d365dd52c106cabad73a lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -32,7 +32,7 @@ # Create return value. try: - return self.app.toolbox.to_dict( trans, in_panel=in_panel, trackster=trackster ) + return self.app.toolbox.to_dict( trans, in_panel=in_panel, trackster=trackster) except Exception, exc: log.error( 'could not convert toolbox to dictionary: %s', str( exc ), exc_info=True ) trans.response.status = 500 @@ -86,6 +86,17 @@ for k, v in payload.iteritems(): if k.startswith("files_"): inputs[k] = v + + #for inputs that are coming from the Library, copy them into the history + input_patch = {} + for k, v in inputs.iteritems(): + if isinstance(v, dict) and v.get('src', '') == 'ldda' and 'id' in v: + ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id(v['id']) ) + if trans.user_is_admin() or trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), ldda.dataset ): + input_patch[k] = ldda.to_history_dataset_association(target_history, add_to_history=True) + + for k, v in input_patch.iteritems(): + inputs[k] = v # HACK: add run button so that tool.handle_input will run tool. inputs['runtool_btn'] = 'Execute' https://bitbucket.org/galaxy/galaxy-central/commits/e3e7b034cb0b/ Changeset: e3e7b034cb0b Branch: tool_api_submit User: carlfeberhard Date: 2013-09-16 21:45:04 Summary: Close branch tool_api_submit Affected #: 0 files 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