Commit Graph
64 Commits
Author SHA1 Message Date
Helena Rasche 646b133bb3 Add EDAM topics to unannotated tools 2020-10-30 17:59:45 +01:00
John Chilton f93cc11e66 Pluggable URI handling across upload components.
*Overview*

This work defines an interface for interacting with "filesystem"-like entities during "upload". In addition to being a pluggable framework adding important new capabilities to Galaxy, this is a generalization and formalization of existing file sources (e.g. the directories described by `library_import_dir`, `user_library_dir`, and `ftp_upload_dir`).

*Plugin Infrastructure*

This introduces a new plugin `FilesSource` to represent sources of directories and files during "upload". A `FilesSource` plugin should be able to index directories and download (called 'realize' to be generic) files to local posix directories. Indexing is used by the remote_files API to provide the client with hierarchies to navigate and to build URIs for the files. The 'realize' operation is used by the 'upload1' and '__DATA_FETCH__' and tools during upload to bring the files into Galaxy as datasets.

An instance of the `ConfiguredFileSources` class is responsible for managing individual instances of `FilesSource` plugins. It has methods to map URIs to the appropriate plugin instance.

The `ConfiguredFileSources` class tracks the loaded plugins and reuses the go to `galaxy.util.plugin_config` module for loading YAML (or XML) definitions of plugins (the same dependency resolvers, job metrics, auth backends, etc. do). A `ConfiguredFileSources` object can serialize itself to a file and re-materialize it during job execution to allow using this abstraction during uploads.

When operating within the Galaxy app, the `ConfiguredFileSources` uses an adapter pattern to parse user-level information from Galaxy's `trans` object. During serialization, the `ConfiguredFileSources` object is expected to encode all the required information about the user that is needed into the output JSON description of the file sources. This is because the web transaction won't be available remotely during the upload job. These objects working in such different ways between the Galaxy process and in the remote job is mildly jarring - so unit tests have been written to ensure this all functions properly.

*Plugin Implementations*

The `FilesSource` interface has a helper implementation base class `BaseFilesSource` that provides some assistance for plugin development. Additionally, the base class `PyFilesystem2FilesSource` extends `BaseFilesSource` but assumes a PyFilesystem2 implementation exists to target the file source of interest - so the plugin author need only provide a PyFilesystem `FS` object describing the target. This commit includes three concrete implementations - posix, webdav, and dropbox. `posix` extends `BaseFilesSource` while the others are light-weight extensions of `PyFilesystem2FilesSource`.

**posix**

While one could imagine a very lightweight implementation based on `PyFilesystem2FilesSource` this fully worked through plugin is implemented directly to ensure we respect Galaxy's strong security checks on paths containing symlinks and preserve the semantics `user_library_import_symlink_allowlist`.

**webdav**

Galaxy tools for integrating OwnCloud exist - see https://github.com/shiltemann/Galaxy-Owncloud-Integration, part of the driver for this work was extending that idea to provide more integrated UX for uploading that data. So this work includes a WebDav plugin (and associated test cases) that could potentially target OwnCloud.

This plugin was a good exercise in flushing and testing the PyFilesystem2 interface but the PyFilesystem2 WebDAV implementation seems a bit fragile... we might want to replace it with more direct APIs but we can take a wait and see approach.

The config YAML for a webdav plugin that lets user's target their own OwnCloud servers configured via user preferences might look something like:

```
- type: webdav
  id: owncloud1
  label: OwnCloud
  doc: User-configured OwnCloud files
  url: ${user.preferences['owncloud|url']}
  login: ${user.preferences['owncloud|username']}
  password: ${user.preferences['webdav|password']}
```

The configuration would provide a user's OwnCloud files at `gxfiles://owncloud1/`.

If instead, a big centralized WebDav server is made available with public data for all users (mirroring use cases of `library_import_dir`) - a simpler configuration not requiring user preferences might be something like:

```
- type: webdav
  id: lab
  label: Lab WebDAV server
  doc: Our lab's research files managed at ourlab.org.
  url: http://ourlab.org:7083
  login: ${environ.get('WEBDAV_LOGIN')}
  password: ${environ.get('WEBDAV_PASSWORD')}
```

The configuration would provide a these WebDAV files at `gxfiles://lab/`.

These two examples demonstrate basic templating is allowed inside the YAML configuration. These are Cheetah templates exposing very specific views of the 'user', 'config', and the whole 'environ' available to the Galaxy server.

**dropbox**

The Dropbox PyFilesystem2 plugin is even easier to configure, all that is needed is a Dropbox access token (this can be configured from the settings menu and may be isolated to a specific app specific folder for added security on the user's part).

An example of such a plugin might be:

```
- type: dropbox
  id: dropbox1
  label: Dropbox Files
  doc: Your Dropbox files - configure an access token via the user preferences
  accessToken: ${user.preferences['dropbox|access_token']}
```

The configuration would provide a user's Dropbox files at `gxfiles://dropbox1/`.

**gxftp**

This is an automatically populated plugin (if `ftp_upload_dir` is configured in Galaxy) that provides the user's FTP files at `gxftp://`.

**gximport**

This is an automatically populated plugin (if `library_import_dir` is configured in Galaxy) that provides Galaxy's library import files at `gximport://`.

**gxuserimport**

This is an automatically populated plugin (if `user_library_import_dir` is configured in Galaxy) that provides the requesting user's Galaxy's user library import files at `gximportfiles://`.

*Why not a tool?*

One could imagine a tool - but the upload dialog has many advanced options for selecting how to ingest files (convert tabs and newlines, select format vs. detect, select dbkey, organize into collections, organize via rules, etc...). It would be next to impossible to provide all these same options via a normal tool and the user experience would be very different than using the upload components in Galaxy - which have been optimized and designed for this task.

That said - one future direction I would like to take this is to be able to mark plugins as writable and implement a new tool form input type "export_directory" or something like that. This could then be used to write data export tools. This could be used to write generalizations of the the cloud send tool.

*`ObjectStore` vs `FilesSource`*

ObjectStores provide datasets not files, the files are organized logically in a very flat way around a dataset. `FilesSource` s instead provide files and directories, not datasets. A `FilesSource` is meant to be browsed in hierarchical fashion - and also has no concept of extra files, etc..

*Future Work*

- This is hopefully going to serve as the basis of a first pass at Terra integration with Galaxy using the FISS lib. Having an implementation based on `PyFilesytem2` means we could potentially integrate support for S3, Basespace, Google Drive, OneDrive, etc..
- Tool form support for selecting files for import and directories for export.
- Allow writing collection archives, history export, etc.. to the `FilesSource` - this would really enhance the UI around getting big stuff out of Galaxy potentially I think.

Rebase into galaxy.files...
2020-07-14 10:09:50 -04:00
M Bernt fc58fd082a properly quote paths in upload script 2020-01-15 21:46:24 +01:00
John Chilton bf550da2af Merge pull request #6684 from nsoranzo/deprecate_param_size
Deprecate `size` attribute of `<param/>` and remove it from tools
2018-12-12 10:51:28 -05:00
John Chilton dd6b185ab8 Implement composite uploads on arbitrary datatypes.
Prior to this, composite uploads were only allowed for select data types. As far as I can tell, the framework itself allows arbitrary datatypes to have extra files. This allows the upload API to take in extra files for datatypes that aren't explicitly annotated has having extra files.

These may be specified one at a time or in directory structures via tar files.
2018-10-24 09:55:25 -04:00
Nicola Soranzo f865e8359f Deprecate size attribute of <param/> and remove it from tools
Also:
- dos2unix test/functional/tools/for_workflows/head.xml
- Single-quote text and data params in `<command/>`
- Remove deprecated `interpreter` attribute of `<command />`
2018-09-10 11:34:37 +01:00
Nate Coraor ef6f7f62ab Memory usage bug fixes and code cleanup/simplification for upload tool 2018-03-15 14:32:02 -04:00
John Chilton d9d8f5d327 Eliminate precreated datasets concept in upload API.
Was used by the async controller in the past I think (https://github.com/galaxyproject/galaxy/blob/v13.01/lib/galaxy/webapps/galaxy/controllers/tool_runner.py#L256), but doesn't seem to be used now.
2018-02-26 11:00:05 -05:00
mvdbeek bac56d6b27 Drop samtools from metadata and upload tools
We only need samtools for the dataproviders, which shouldn't
be used by these tools.
2017-12-08 11:35:31 +01:00
John Chilton 1fa4ea2a8a Allow multiple simulatenous uploads via single POST.
The upload.py tool itself already allowed this and update upload dataset grouping to handle this.
2017-10-02 14:59:35 -04:00
John Chilton fec1eab82d Add ability to arbitrarily not decompress files on upload via API. 2017-08-12 06:36:50 -04:00
John Chilton d06e2a672b XSD discovered tool problems. 2016-09-08 11:40:01 -04:00
guerler 193c5293d9 Remove invalid validator from upload.xml 2016-01-26 14:49:35 -05:00
Marek Vavrusa bc8bdadca8 datatypes: extracted TabularData superclass from Tabular, CSV subclass 2015-04-30 17:20:32 +02:00
Kyle Ellrott 9d67f9c599 Hiding UUID input for upload tool 2014-08-18 16:37:30 -07:00
Kyle Ellrott a2ac71eab9 Enabling UUID in file upload 2014-08-14 17:08:29 -07:00
Aysam Guerler ba0362aa8d Add get data back to to tool panel (will be replaced by a placeholder soon) 2014-02-19 12:51:52 -05:00
Aysam Guerler 73e74f74c8 Upload: Hide former upload tool 2014-02-18 14:57:08 -05:00
John Chilton 323a7c57c7 Fix for b1121a315205e8152d9c59199443c492340e9f0b.
That did not work in Bjoern's setup for reasons that still are eluding me - but this variant works and is less hacky, more readable anyway.
2014-01-20 08:35:50 -06:00
John Chilton 915948a305 Hide to_posix_lines in UI by default.
Galaxy still completely supports this option on backend - API tests still completely work and will hopefully ensure this functionality continues running. Any Galaxy deployements that wish to enable this option simply have to switch this one param from hidden to select. This is a ugly workaround - but it is a very small workaround - and will hopefully alleviate any potential fears Gert Hulselmans has of Galaxy diverging from his changes. This is only a stop gap until the Galaxy upload UI supports more advanced options.

I have previously outlined my concerns with the visual clutter on the upload.xml page - this is why I am hiding it by default. If anyone with commit access disagrees - please by all means backout of this individual changeset and restore the full functionality of pull request 171 (I have a terrible eye for this sort of GUI design stuff).
2014-01-17 00:03:26 -06:00
Gert Hulselmans fb01c3cc96 Avoid corruption of binary files embedded in gzip, bz2 and zip archives in the upload tool.
Add an option in the upload tool to disable the conversion of universal
line endings to Posix line endings.
This is useful for avoiding corruption of uploaded files when a binary
file is contained inside a gzip, bz2 and zip archive.

This fixes bug report: https://trello.com/card/issue-with-uploaded-2bit-gz-files/506338ce32ae458f6d15e4b3/702
2013-05-27 20:55:52 +02:00
John Chilton 262413f7c0 Based on input from natefoo, replace root tool tag "upload" with inverse tag "workflow_compatible". Adjust logic in tools module accordingly. 2013-02-13 10:45:56 -06:00
John Chilton 7e6ee45bb0 Add optional "upload" attribute to tool definitions.
When extracting workflows, such tools are treated as inputs. This eliminates the need for the hack of hardcoding 'upload1' in tools.py and allows multiple upload tools to exist and function properly when extracting workflows.
2013-02-10 11:13:51 -06:00
Daniel Blankenberg a273960126 Backout 3189a1bf18af 2013-02-04 06:43:35 -05:00
Daniel Blankenberg bab984ed69 Add sentry_dsn to Tool Shed config.py' lib/galaxy/webapps/community/config.py 2013-02-04 06:33:19 -05:00
Brad Chapman cf1407d471 Correctly set history and handle output datasets for error cases in tool API. Allow specification of dataset name during uploads, exposing through API 2012-10-04 15:31:16 -04:00
Nate Coraor 03c4fa3689 The upload tool requires samtools to upload BAM files, the Pileup tool requires samtools <= 0.1.16. 2011-12-06 11:42:12 -05:00
Kanwei Li a9370f1b72 Spacing fix 2011-08-20 02:56:33 -04:00
Nate Coraor 1026641425 Don't provde the output filename to the upload tool if it's outside Galaxy's files_path, since this means we're only linking data and the output paths are not used (and may contain non-shell-safe characters). Fixes issue #533. 2011-06-08 13:25:45 -04:00
Nate Coraor 15aa3cba69 Highlight the futility of uploading files >2GB via a browser. 2011-01-14 23:52:31 -05:00
Nate Coraor c9a881e114 Add a new "Files uploaded via FTP" grid to the upload form and related parameter types, form fields, etc. 2010-11-05 11:04:50 -04:00
Nate Coraor 4ca447aa70 Add support for bz2 compressed uploads. 2010-09-10 14:07:16 -04:00
Nate Coraor 8a66864aee Stop ignoring the sniff order set in the datatypes config file. 2010-08-18 14:56:10 -04:00
Nate Coraor 7c71894533 Remove obsolete binseq.zip and txtseq.zip formats, and allow for uploading single files in a zip archive. Adapted from a patch from Pablo Cingolani. 2010-06-23 16:48:13 -04:00
Nate Coraor ca066cef04 Add a tip to the upload tool about using url paste for big files 2010-05-04 10:18:42 -04:00
Greg Von Kuster 0e807f13f5 Add support for uploading BAM files. 2009-12-02 20:02:05 -05:00
Greg Von Kuster dd32491716 A bit of code cleanup in genetics.py, and add all rgenetics data types to datatypes_conf.xml.sample. Also include the new Sff data type in the upload config help section. 2009-11-13 16:24:00 -05:00
Nate Coraor e8cbb18a87 Make Galaxy attempt to honor the user's umask and primary group (output datasets can have the wrong primary group if the primary group differs on the cluster). Also fixed a composite datatype files_path bug in the upload tool. 2009-10-23 14:33:23 -04:00
Nate Coraor d14eb4d653 Reintroduce nginx upload module support.
http://www.grid.net.ru/nginx/upload.en.html

The following config variables are added to universe_wsgi.ini:

    nginx_upload_store = Path to nginx upload store
        ex: = database/upload_store
    nginx_upload_path = URL (from root of the Galaxy server) to direct upload POSTs to
        ex: = /_upload

The following nginx config supports such a configuration:

    location /_upload {
        upload_store /path/to/galaxy/database/upload_store;
        upload_pass_form_field "tool_id";
        upload_pass_form_field "tool_state";
        upload_pass_form_field "async_datasets";
        upload_pass_form_field "^files_[0-9]+\|.*";
        upload_pass_form_field "file_type";
        upload_pass_form_field "dbkey";
        upload_pass_form_field "runtool_btn";
        upload_pass_form_field "ajax_upload";
        upload_pass_form_field "upload_option";
        upload_pass_form_field "library_id";
        upload_pass_form_field "folder_id";
        upload_pass_form_field "message";
        upload_pass_form_field "roles";
        upload_set_form_field "__${upload_field_name}__is_composite" "true";
        upload_set_form_field "__${upload_field_name}__keys" "name path";
        upload_set_form_field "${upload_field_name}_name" "$upload_file_name";
        upload_set_form_field "${upload_field_name}_path" "$upload_tmp_path";
        upload_pass_args on;
        upload_pass /_upload_done;
    }

    location /_upload_done {
        set $dst /tool_runner/index;
        if ($args ~ nginx_redir=([^&]+)) {
            set $dst $1;
        }
        rewrite "" $dst;
    }
2009-09-29 17:14:20 -04:00
Kanwei Li 3531212ff6 typo fixes for tools in folders A-M 2009-09-27 23:11:43 -04:00
Nate Coraor 6f3a169b01 Get rid of the hacky "alternate path" stuff used by the upload tool and fix setting metadata when using autodetect and set_metadata_externally 2009-09-10 14:52:38 -04:00
Nate Coraor 3f5da01132 Real Job(tm) upload support 2009-08-20 10:49:54 -04:00
Daniel Blankenberg cc22aee3cb Initial pass at allowing the setting of certain metadata parameters on upload (controlled via a flag). This allows the user to specify the 'base_name' to be used for Rgenetics datatypes, etc. Bunch of cleanup needed in upload. 2009-07-15 14:11:35 -04:00
James Taylor db9c0a9870 Commenting out 'other dbkey' in upload 2009-06-11 15:41:57 -04:00
James Taylor 537f8952ef Merging Ian's trackster update with current head 2009-06-11 12:20:03 -04:00
Daniel Blankenberg c0d797e00d Allow the uploading of composite datatypes. A new grouping parameter, UploadDataset, is used to contain and process the file_data/url_paste/space_to_tab used to upload a file - multiple sets are displayed when uploading a composite datatype (similar to a repeat). Composite files can now be declared to the datatypes registry (required for proper uploading), but they are stored in the same manner as before (the extra_files_path) and should be backwards compatible. When uploading a composite datatype, only one dataset can be uploaded at a time. The ability to upload multiple datasets (url_paste (contents or urls) + file_data) for non-composite datatypes remains unchanged.
A more structured way of storing these files (rather than dumping in a directory) is worth considering.
2009-06-08 12:49:26 -04:00
Ian Schenck feda672ffa - Performance of indexers much improved.
- Indexing for tracks done in background with a visual treatment done to Trackster

- DB builds can be uploaded by a user (chromInfo/len extension).

- TODO: Add ability to change the dbkey of a dataset to any arbitrary string value.
2009-04-23 13:46:52 -04:00
Nate Coraor 86eb5e62b2 Asynchronous uploads. Currently disabled in IE, since IE throws
occasional 'permission denied' errors when jquery attempts to set the
form target.  Compatible with the nginx upload module, but interrupted
uploads will remain in the 'upload' state indefinitely.
2009-03-13 13:48:59 -04:00
Greg Von Kuster 666de20b4d Cleanup for fastqsolexa data type converters. We are currently supporting only the Solexa variant and will add support for other variants when the formats stabilize. 2008-06-09 20:15:04 +00:00
Wen-Yu Chung 782d7db6be Update fastq format.
Now we only support FastqSolexa variants.
If the quality scores are presented as characters,
the integer values are obtained by their ascii code subtract 64.
2008-06-06 18:52:11 +00:00