Commit Graph
452 Commits
Author SHA1 Message Date
mvdbeek 33ccacf77a Fix upload1 tool 2023-12-01 19:57:38 +01:00
Yakubov, Sergey c30a4c06c2 Replace file_name property with get_file_name function 2023-11-08 17:17:14 -05:00
Nicola Soranzo d258e5791e Fix new E721 errors from ruff 0.0.290 2023-09-20 01:43:40 +01:00
mvdbeek 0bac18d0bb Drop old run_as_real_user check 2023-06-06 18:52:32 +02:00
Nicola Soranzo 64af46c4ae Fix new B018 errors raised by ruff 0.0.260 2023-04-13 16:53:01 +01:00
Nicola Soranzo 30f60493c3 Format Python code with black 23.1.0
with manual fixes to 3 files to make them compatible with black 22.12.0 .

We need to keep black pinned at `<23` until we vendorise `packaging`, since
the new version of black depends on `packaging >=22.0` which is the version
where `LegacyVersion` (which we use for tool lineages) was removed.
2023-02-01 23:51:03 +00:00
Nicola Soranzo 3bca59b8e9 Remove uses of six library
Remove unused file `tools/data_source/hbvar_filter.py` .
2022-06-10 10:32:00 +01:00
John Chilton 37892dcabc Refactor sniff.stream_url_to_file to galaxy.files.uris.
The value of this can be seen for instance in unpack_tar_gz_archive - which should have nothing to do with datatypes and now doesn't need to load the whole datatypes module.

Use this in workflows API to allow downloading workflow files from configured URIs.
2022-05-21 17:22:41 -04:00
mvdbeek 4ca0d63c3b Merge branch 'release_22.01' into dev 2022-05-04 17:10:29 +02:00
mvdbeek da1dd283f3 Add @TOOL_VERSION@ token for NCBI Datasets Genomes 2022-05-04 16:34:09 +02:00
mvdbeek 5c014d2048 Bump ncb-datasets-cli dependency to 13.14.0
Fixes

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x8a3fea]

goroutine 1 [running]:
main/datasets/datasets.downloadData(0xc000010380, 0x0, 0x0, 0x0, 0x7ffe36956316, 0x62, 0xffffffffffffffff, 0x0, 0x0)
	src/datasets/datasets/Download.go:41 +0xea
main/datasets/datasets.downloadAssembly(0xc000069100, 0x7ffe36956316, 0x62, 0x8ef4a0, 0xc000010298)
	src/datasets/datasets/DownloadGenome.go:63 +0x294
main/datasets/datasets.glob..func1(0xd9d080, 0xc000074730, 0x0, 0x5, 0x0, 0x0)
	src/datasets/datasets/Download.go:106 +0x2a7
github.com/spf13/cobra.(*Command).execute(0xd9d080, 0xc0000746e0, 0x5, 0x5, 0xd9d080, 0xc0000746e0)
	external/com_github_spf13_cobra/command.go:842 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xd9cde0, 0x4686c5, 0xc000000180, 0x200000003)
	external/com_github_spf13_cobra/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	external/com_github_spf13_cobra/command.go:887
main/datasets/datasets.Execute()
	src/datasets/datasets/root.go:444 +0x31
main.main()
	src/cmd/datasets/main.go:10 +0x25
```
2022-05-03 17:13:16 +02:00
Dannon Baker 03351d2a9f Apply black to tools as well 2022-02-03 09:12:13 -05:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
Nicola Soranzo 30337fbd94 Merge branch 'release_21.09' into dev 2021-11-23 13:30:36 +00:00
Marius van den Beek 90c2f31cb4 Don't add ca-ceritificates to tool requirements
ca-certificates is now part of the ncbi-datasets-cli conda package
2021-11-18 17:17:19 +01:00
Marius van den BeekandHelena f1986a481f Export just once
Thanks!

Co-authored-by: Helena <hxr@hx42.org>
2021-11-17 15:28:07 +01:00
mvdbeek 47120ca48f Fix containerized NCBI Datasets Genomes data source tool 2021-11-12 20:17:34 +01:00
John Chilton 4fe7109ab1 Track transformations applied during uploads. 2021-11-12 10:21:55 -05:00
John Chilton 8643daf1dd Attempt to type more upload related things. 2021-11-05 11:58:53 -04:00
mvdbeek 63e25b20f4 Set profile version of ncbi_datasets so it can run containerized 2021-10-31 16:28:38 +01:00
mvdbeek a10645d664 Use ncbi_genome_dataset.zip format 2021-09-13 12:05:53 +02:00
mvdbeek 947832541b Use version_command tag, single quotes for paths 2021-09-09 19:15:19 +02:00
Brad Holmes 8b77edbb53 Implement NCBI Datasets Genome Dataset server 2021-09-09 12:28:02 -04:00
Brad Holmes 0186289a63 Improve wording and target URL for NCBI Datasets Genomes link tool 2021-09-08 11:00:39 -04:00
mvdbeek 44ee10e93d Add json_param as possible parameter type 2021-08-31 16:49:54 +02:00
mvdbeek 278b1422fd Replace taxon with generic file parameter 2021-08-31 16:45:56 +02:00
mvdbeek 58e530e65a Use separate dehydrated.zip datatype subclass 2021-08-31 16:45:56 +02:00
mvdbeek e552f79b49 Add dependency on ncbi-datasets-cli 2021-08-31 16:45:55 +02:00
mvdbeek e0855b7d9a Add simple NCBI datasets source tool 2021-08-31 16:45:55 +02:00
mvdbeek 11363a013e Merge branch 'release_21.05' into dev 2021-06-24 12:22:55 +02:00
mvdbeek 4dabdf4282 Add socket timeout for urlopen 2021-06-20 14:04:23 +02:00
mvdbeek 9d45e2b0db Remove unused legacy controller things 2021-06-19 16:28:56 +02:00
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