commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/40b252052087/ changeset: 40b252052087 user: chapmanb date: 2012-10-04 21:31:16 summary: Correctly set history and handle output datasets for error cases in tool API. Allow specification of dataset name during uploads, exposing through API affected #: 3 files diff -r f3b183e756f9b209ef0904718ed547e04c74ab7a -r 40b252052087bc06fd1adc47f9633a496a7dd07c lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -209,7 +209,7 @@ dataset_name = get_file_name( data_file['filename'] ) if not dataset_info: dataset_info = 'uploaded file' - return Bunch( type='file', path=data_file['local_filename'], name=get_file_name( data_file['filename'] ) ) + return Bunch( type='file', path=data_file['local_filename'], name=dataset_name ) #return 'file', data_file['local_filename'], get_file_name( data_file.filename ), dataset_name, dataset_info except: # The uploaded file should've been persisted by the upload tool action @@ -227,14 +227,13 @@ if line: if not line.lower().startswith( 'http://' ) and not line.lower().startswith( 'ftp://' ) and not line.lower().startswith( 'https://' ): continue # non-url line, ignore - precreated_name = line dataset_name = override_name if not dataset_name: dataset_name = line dataset_info = override_info if not dataset_info: dataset_info = 'uploaded url' - yield Bunch( type='url', path=line, name=precreated_name ) + yield Bunch( type='url', path=line, name=dataset_name ) #yield ( 'url', line, precreated_name, dataset_name, dataset_info ) else: dataset_name = dataset_info = precreated_name = 'Pasted Entry' #we need to differentiate between various url pastes here diff -r f3b183e756f9b209ef0904718ed547e04c74ab7a -r 40b252052087bc06fd1adc47f9633a496a7dd07c lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -55,6 +55,17 @@ tool = trans.app.toolbox.get_tool( tool_id ) if not tool: return { "message": { "type": "error", "text" : messages.NO_TOOL } } + + # Set running history from payload parameters. + # History not set correctly as part of this API call for + # dataset upload. + history_id = payload.get("history_id", None) + if history_id: + target_history = trans.sa_session.query(trans.app.model.History).get( + trans.security.decode_id(history_id)) + trans.galaxy_session.current_history = target_history + else: + target_history = None # Set up inputs. inputs = payload[ 'inputs' ] @@ -62,10 +73,10 @@ inputs['runtool_btn'] = 'Execute' # TODO: encode data ids and decode ids. params = util.Params( inputs, sanitize = False ) - template, vars = tool.handle_input( trans, params.__dict__ ) - + template, vars = tool.handle_input( trans, params.__dict__, history=target_history) + # TODO: check for errors and ensure that output dataset(s) are available. - output_datasets = vars[ 'out_data' ].values() + output_datasets = vars.get('out_data', {}).values() rval = { "outputs": [] } diff -r f3b183e756f9b209ef0904718ed547e04c74ab7a -r 40b252052087bc06fd1adc47f9633a496a7dd07c tools/data_source/upload.xml --- a/tools/data_source/upload.xml +++ b/tools/data_source/upload.xml @@ -41,6 +41,7 @@ <param name="space_to_tab" type="select" display="checkboxes" multiple="True" label="Convert spaces to tabs" help="Use this option if you are entering intervals by hand."><option value="Yes">Yes</option></param> + <param name="NAME" type="hidden" help="Name for dataset in upload"></param></upload_dataset><param name="dbkey" type="genomebuild" label="Genome" /><conditional name="files_metadata" title="Specify metadata" value_from="self:app.datatypes_registry.get_upload_metadata_params" value_ref="file_type" value_ref_in_group="False" /> https://bitbucket.org/galaxy/galaxy-central/changeset/413cf15e4065/ changeset: 413cf15e4065 user: jgoecks date: 2012-10-09 05:44:02 summary: Merged in chapmanb/galaxy-central-apiupload (pull request #74) affected #: 3 files diff -r 8269f76312af60e356707bc660b6e9903e402106 -r 413cf15e4065a9f8d559ca110e6e86b84f8a6620 lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -209,7 +209,7 @@ dataset_name = get_file_name( data_file['filename'] ) if not dataset_info: dataset_info = 'uploaded file' - return Bunch( type='file', path=data_file['local_filename'], name=get_file_name( data_file['filename'] ) ) + return Bunch( type='file', path=data_file['local_filename'], name=dataset_name ) #return 'file', data_file['local_filename'], get_file_name( data_file.filename ), dataset_name, dataset_info except: # The uploaded file should've been persisted by the upload tool action @@ -227,14 +227,13 @@ if line: if not line.lower().startswith( 'http://' ) and not line.lower().startswith( 'ftp://' ) and not line.lower().startswith( 'https://' ): continue # non-url line, ignore - precreated_name = line dataset_name = override_name if not dataset_name: dataset_name = line dataset_info = override_info if not dataset_info: dataset_info = 'uploaded url' - yield Bunch( type='url', path=line, name=precreated_name ) + yield Bunch( type='url', path=line, name=dataset_name ) #yield ( 'url', line, precreated_name, dataset_name, dataset_info ) else: dataset_name = dataset_info = precreated_name = 'Pasted Entry' #we need to differentiate between various url pastes here diff -r 8269f76312af60e356707bc660b6e9903e402106 -r 413cf15e4065a9f8d559ca110e6e86b84f8a6620 lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -55,6 +55,17 @@ tool = trans.app.toolbox.get_tool( tool_id ) if not tool: return { "message": { "type": "error", "text" : messages.NO_TOOL } } + + # Set running history from payload parameters. + # History not set correctly as part of this API call for + # dataset upload. + history_id = payload.get("history_id", None) + if history_id: + target_history = trans.sa_session.query(trans.app.model.History).get( + trans.security.decode_id(history_id)) + trans.galaxy_session.current_history = target_history + else: + target_history = None # Set up inputs. inputs = payload[ 'inputs' ] @@ -62,10 +73,10 @@ inputs['runtool_btn'] = 'Execute' # TODO: encode data ids and decode ids. params = util.Params( inputs, sanitize = False ) - template, vars = tool.handle_input( trans, params.__dict__ ) - + template, vars = tool.handle_input( trans, params.__dict__, history=target_history) + # TODO: check for errors and ensure that output dataset(s) are available. - output_datasets = vars[ 'out_data' ].values() + output_datasets = vars.get('out_data', {}).values() rval = { "outputs": [] } diff -r 8269f76312af60e356707bc660b6e9903e402106 -r 413cf15e4065a9f8d559ca110e6e86b84f8a6620 tools/data_source/upload.xml --- a/tools/data_source/upload.xml +++ b/tools/data_source/upload.xml @@ -41,6 +41,7 @@ <param name="space_to_tab" type="select" display="checkboxes" multiple="True" label="Convert spaces to tabs" help="Use this option if you are entering intervals by hand."><option value="Yes">Yes</option></param> + <param name="NAME" type="hidden" help="Name for dataset in upload"></param></upload_dataset><param name="dbkey" type="genomebuild" label="Genome" /><conditional name="files_metadata" title="Specify metadata" value_from="self:app.datatypes_registry.get_upload_metadata_params" value_ref="file_type" value_ref_in_group="False" /> 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