Commit Graph
420 Commits
Author SHA1 Message Date
John Chilton 2a0474730b Rev mypy. 2021-04-23 14:49:53 -04:00
mvdbeek f85086f6d5 Assert file:// urls are not being downloaded without explicit handling
And allow file_sources in add_composite_file to_path
2021-04-20 16:24:41 +02:00
Matthias Bernt cfd0f02c56 add and use a new util foo is_url 2021-04-12 16:13:52 +02:00
Nicola Soranzo d26b3d9848 Fix all E203, E741 and W504 flake8 errors 2021-01-18 10:35:41 +00:00
Nicola Soranzo 452aba9ee3 Fix remaining issues reported by bugbear; add it to flake8 reqs 2021-01-16 05:58:15 +00:00
Marius van den Beek af4d041dc9 Merge pull request #10592 from hexylena/edam-tool-panel
EDAM tool panel
2021-01-08 18:56:28 +01:00
Nicola Soranzo 970c23015e Remove commented lines 2021-01-07 20:42:27 +00:00
M Bernt ea88a8a5a3 allow empty file uploads 2021-01-07 19:38:53 +01:00
Helena Rasche 646b133bb3 Add EDAM topics to unannotated tools 2020-10-30 17:59:45 +01:00
Nicola Soranzo 9d74bba7fb Drop support for retired Python 3.5
Upgrade syntax using `pyupgrade --py36-plus` .

Manually drop several `six` imports.

Also:
- Remove broken pr_cache in scripts/bootstrap_history.py
- Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
2020-10-07 11:52:13 +01:00
Björn Grüning f0179efb6a Merge pull request #9888 from jmchilton/galaxy_files_2
Pluggable URI handling across upload components.
2020-07-27 23:08:20 +02:00
John Chilton 67ef0a4a75 Enable uploading extra files via the data fetch API endpoint.
Implement both datatype driven composite files and free-style extra files - both implemented in much more hacky ways in current upload.xml API driven endpoint.
2020-07-22 11:10:39 -04: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
John Chilton 62fe61abdc Fix sniffing composite files to reuse existing abstractions. 2020-07-14 10:09:19 -04:00
mvdbeek 278a033372 Add SraManifest datatype
This datatype auto-generates its column_names from the first line of the
dataset, since the user can choose which columns to include.
2020-06-22 17:03:26 +02:00
mvdbeek ee8d9f0877 Update sra_source tool to outut sra_manifest.tabular 2020-06-22 17:01:36 +02:00
Marius van den Beek 4637149008 Merge pull request #9490 from nsoranzo/remove_command_interpreter
Remove deprecated ``interpreter`` attribute from tools ``<command>``
2020-05-04 17:25:00 +02:00
mvdbeek 2994f51565 Drop unnecessary parameters, quote tool, modernize 2020-04-14 15:34:10 +02:00
mvdbeek e367681ce0 Update url for sra tool to https://www.ncbi.nlm.nih.gov/sra 2020-04-14 15:20:04 +02:00
Martin Cech 51c383453f add basic data source tool for SRA testing 2020-04-14 15:18:41 +02:00
Nicola Soranzo ef4f5ccda4 Remove deprecated `interpreter attribute from tools <command>` 2020-03-05 12:53:09 +01:00
M Bernt fc58fd082a properly quote paths in upload script 2020-01-15 21:46:24 +01:00
John Chilton c327f9bf3d Improve logging around provided metadata indicated errors. 2019-10-24 13:34:07 -04:00
mvdbeek 19d32f8b38 Change most str(e) / str(exc) to unicodify
I skipped migrations and import error exceptions.
2019-06-26 14:57:26 +02:00
mvdbeek 47ed81feb9 Remove unreachable print statement
I don't think an exception could ever occur here.
2019-02-26 12:06:07 +01:00
mvdbeek 8d99791afb Fix data_source tools on python 3 2019-01-18 12:13:13 +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 f035d642ce Merge pull request #6844 from jmchilton/compressed_types_and_extra_files
Infrastructure/API Support for Composite Uploads/Downloads
2018-11-01 10:57:09 -04:00
Nicola Soranzo f4203ca051 Fix errors reported by flake8 3.6.0
Ignore W504.
2018-10-24 23:22:19 +01: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 949dcfdbc3 Do not log exceptions twice
`logging.exception()` already adds the the exception information after
the supplied message.

Also: the `message` attribute of `Exception` class has been dropped in
Python 3, always use `str(e)`.

xref. https://github.com/galaxyproject/galaxy/issues/1715
2018-10-24 12:57:05 +01:00
Pierrick ROGER efc7864cab Merge branch 'dev' into feature/isa_data_type 2018-10-18 10:36:49 +02: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
Nicola Soranzo 952fdac419 Remove unused and broken tool 2018-09-10 11:16:55 +01:00
Nicola Soranzo f5bd245faa Merge branch 'release_18.05' into dev 2018-08-17 16:39:29 +01:00
Dannon Baker 1cd36e3f81 Bump version; 'patch' since it should be the exact same, as much as anything over the net ever could be\? 2018-08-10 11:27:17 -04:00
Dannon Baker 2839475967 Update ucsc genome-test server URL. 2018-08-10 11:19:13 -04:00
mvdbeek 66af9ce961 Make upload tool python3 compatible 2018-07-16 20:15:11 +01:00
takadonet 4b0ae30a83 Added fix to ensure that original ftp files that have been uploaded are purged if set in galaxy.yml with flag ftp_upload_purge. Address issue #6492 2018-07-12 16:35:35 -04:00
Martin Cech 89c62229c5 remove dead link
I did not find the original post
2018-07-12 16:02:00 -04:00
takadonet 4da67218c1 Added fix to ensure that original ftp files that have been uploaded are purged if set in galaxy.yml with flag ftp_upload_purge. Address issue #6492 2018-07-12 12:08:15 -05:00
Daniel Blankenberg 433d464870 Update InterMine 2018-07-01 16:20:13 -07:00
Daniel Blankenberg 08547faddd Intermine from Hack 2018-06-30 15:08:02 -07:00
John Chilton 9b232c87ad Allow empty files to be uploaded if check content is off. 2018-06-29 15:56:39 -07:00
Pierrick Roger 60d0d9d5ec Add grooming for composite files.
Add call to groom_dataset_content() for composite files.
2018-06-07 11:47:56 +01:00
John Chilton cdbae706e6 Respect auto_decompress in fetch API, synchronize upload APIs. 2018-05-15 07:39:14 -04:00
John Chilton b4de30b5fc Small fixes for upload flags (auto_decompress, check_content, space_to_tab). 2018-05-15 06:28:54 -04:00
John Chilton 8a58711e39 Remove validate_mode prop for sniffing, no longer needed with previous fixes.
This does undo an attempt that Nate made to auto sniff fastq.gz files when they can't be converted anyway, but that was kind of broken in its own way.

From Gitter:

jmchilton: natefoo "# Link mode can't decompress anyway, so enable sniffing for keep-compressed datatypes even when auto_decompress is enabled" Did you test this hack? I get the thought process but it seems like it results in uploaded fastq.gz files defaulting to fastqcssanger.gz? Maybe it didn't at some point though?

Nate Coraor: ummmmmmmmmmmm maybe probably not

John Chilton: I have four fixes for compressed datatypes that all fall apart because of this hack... can I just use the configured sniff order or do you want me to try to preserve this and write a test case

Nate Coraor: nah go ahead and de-hack

John Chilton: There is a good argument to be made for making the behavior more consistent anyway right? Cool thanks
2018-05-10 18:35:31 -04:00
mvdbeek 2e18ed2c97 Set ext explicitly to dataset.file_type
since it is being used again later. Thanks @nsoranzo!
2018-04-19 10:40:17 +02:00
mvdbeek 6c020a6dbc Fix uploads of link-only datasets to data library
`ext` was never being set in the case of link only datasets, where I think the
right thing is to fall back on `dataset.file_type`.
Fixes https://github.com/galaxyproject/galaxy/issues/5915.
2018-04-19 10:40:17 +02:00