Commit Graph
2438 Commits
Author SHA1 Message Date
Nicola Soranzo b59fb06fd9 Remove unused import 2018-01-17 16:26:56 +00:00
Matthias Bernt 4b2bf122b6 fix for microbial import tool
There seems to be no UnvalidatedValue class anymore. So I removed these
checks which seems to make the tool functional again.

Note that there is one more instance of such a check in the Galaxy
sources (in tools/parameters/basic.py). I guess this can also be
removed?
2018-01-17 15:55:10 +00:00
John Chilton 3f75a2d3a6 Re-work upload clarification from #5206.
See post-merge discussion on that issue.
2018-01-04 09:30:16 -05:00
Dannon Baker 6bf5d663b4 Merge pull request #5229 from jmchilton/upload_refactor
Refactor upload.py toward reuse
2017-12-18 11:15:37 -05:00
John Chilton 7e1bff7d69 Upload refactor - change upload.py to use exceptions.
Make decomposing and reuse of this easier downstream and feels cleaner to me.
2017-12-15 13:24:44 -05:00
John Chilton cafac19f65 Upload refactor - make link_data_only a bool.
Since it is a bool.
2017-12-15 13:24:44 -05:00
John Chilton 09f51f59af Upload optimization - eliminate second call to check_binary in upload.py. 2017-12-15 13:24:44 -05:00
Nicola Soranzo 6d3eadedbd Merge pull request #5227 from jmchilton/merge_1709
Merge 17.09.
2017-12-15 18:14:34 +00:00
John Chilton 90ba35a9a4 Merge remote-tracking branch 'jmchilton/release_17.09' into merge_1709 2017-12-15 12:02:07 -05:00
John Chilton 121285b40b Let ToolProvidedMetadata interface more directly decide if it has failed outputs.
I like this better for three reasons:

- Since usually it is scripts producing this JSON - we have the most control at that point for determining the failure and we don't have to deal with an artificial dependency between the tool's stdio and the output.
- At some point we could potentially allow some datasets to be ok now even though the job fails.
- It is a cleaner interface at the Python level between job finish and output collection IMO (no need for isinstance checking).
2017-12-15 08:34:35 -05:00
Dannon Baker 3b7f40198e Merge pull request #5215 from nsoranzo/python3
Python3: finish first pass on whole codebase
2017-12-14 14:38:17 -05:00
Nicola Soranzo 14259b11d9 Python3: finish first pass on whole codebase 2017-12-14 12:01:01 +00:00
John Chilton 099c1562fe Re-organize edge case upload options for my own clarity.
I think setting each of these variables once and simplifing the context they are used in (in the case of purge_upload) makes it more clear what each variable is and how it is set. I also think one, more detailed comment for each variable helps.

Note: This will break run-as-user uploads started prior to the upgrade to 18.XX and executed after the upgrade. It is a small switch to restore the old behavior but I'm not sure it is worth the complexity it adds to the file.

```
run_as_real_user = dataset.get('run_as_real_user', False) or dataset_get.('in_place', True)
```
2017-12-13 12:54:03 -05:00
Nicola Soranzo b3dc7923db Python3: use collections.Mapping instead of removed DictMixin 2017-12-12 15:30:53 +00: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
Nicola Soranzo 0dfe73a54c Determine dynamically if an extension corresponds to an unsniffable binary datatype
Remove the need to call `Binary.register_unsniffable_binary_ext()` for
each unsniffable binary datatype.

Fix https://github.com/galaxyproject/galaxy/issues/3441 , where the upload
of files of a datatype defined in datatypes_conf.xml as subclass of an
unsniffable binary datatype ended up with "The uploaded binary file
contains inappropriate content" because it was not possible to register the
subclassed datatype as unsniffable.

Also remove unused `stop_err()` function in upload.py .
2017-12-01 10:30:24 +00:00
Nicola Soranzo 0e0acb5200 Remove is_multi_byte from upload.py
Also, when sniffing binary files, sniff images together with the other
formats and respect sniff order.

Also remove `is_multi_byte` from:
- `stream_to_open_named_file()`
- `stream_to_file()`

Remove the now unused `get_image_ext()` and `Binary.is_sniffable_binary()`
and all the calls to `Binary.register_sniffable_binary_format()`.
2017-11-30 18:06:37 +00:00
Nicola Soranzo 59f44cf2be Update get_fileobj() to use utf-8 encoding in text mode
Also, merge its 3 parameters `gzip_only`, `bz2_only`, `zip_only` into
`compressed_formats` (a list of allowed formats).

As a consequence of the changes in `get_fileobj()`, update:
- `files_diff()`
- `get_file_peek()`, which now determines that a file is binary when a
  `UnicodeDecodeError` exception is raised and doesn't need
  `is_multi_byte` any more
- `iter_headers()` and `get_headers()`, which now return Unicode and don't
  need `is_multi_byte` parameter any more

As a consequence of the changes in `get_file_peek()`, update:
- `set_peek()`, which now doesn't need `is_multi_byte` any more

As a consequence of the changes in `get_headers()`, update:
- `guess_ext` and `is_column_based()`, which now determine that a file is
  binary when a `UnicodeDecodeError` exception is raised and don't need
  `is_multi_byte` any more

As a consequence of the changes to `guess_ext`, update:
- `handle_uploaded_dataset_file() doesn't need `is_multi_byte` any more

Also, remove duplicated calls to `get_file_peek()` in
lib/galaxy/datatypes/molecules.py and lib/galaxy/datatypes/msa.py

The `is_multi_byte` was not removed from the signature of `get_file_peek()`
and `set_peek()` in order to preserve compatibility for ToolShed datatypes,
thanks @jmchilton for the review.
2017-11-28 17:46:32 +00:00
M Bernt b2cc634e8a python3 fix (#5043)
strings can not be written to byte mode file handlers.
writing resulted in: TypeError: a bytes-like object is required, not 'str'

Alternative would be to make string byte.
2017-11-20 22:34:02 +01:00
Martin Cech 7157600f85 fix few stray wiki links 2017-11-15 16:39:26 -05:00
Nicola Soranzo 2cd95c48f6 Fix import order everywhere
- Add flake8-import-order to flake8 Pipfile and remove py27-lint-imports
  and py27-lint-imports-include-list tox envs
- Fix most E201 and E202 errors reported by flake8-import-order v0.15,
  but pin flake8-import-order to v0.14.3 until
  https://github.com/PyCQA/flake8-import-order/issues/123
  is fixed

This let us drop 2 jobs on Travis per each job.
2017-11-14 19:42:39 +00:00
Nicola Soranzo 9b4de72ca6 Fix all E722 errors and ignore E741
Introduced in flake8 3.5.0
Fix import order.
2017-10-24 11:29:09 +01:00
Nate Coraor 3a70d0c648 [GX-2017-0003]: Fix for the reported issue, only allow http, https, and
ftp schemes in the data_source tool.
2017-10-23 10:25:22 -04:00
Nate Coraor 391586ba01 [GX-2017-0003]: Fix for the reported issue, only allow http, https, and
ftp schemes in the data_source tool.
2017-10-23 10:24:50 -04:00
Nicola Soranzo d1bc98dfcb Python3: fix remaining print statements
Remove some debugging prints.
Fix import order.
Consolidate exception logging in ToolShed database migrations.
2017-10-12 18:34:29 +01:00
Dannon Baker 562465ffe9 Merge remote-tracking branch 'upstream/release_17.09' into dev 2017-10-04 15:36:15 -04:00
Dannon Baker fbf3cf30d7 Fix joiner tool to inherit datatype, restoring previous behavior. 2017-10-03 14:49:42 -04: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
mvdbeek 3dbdf7d474 Make liftover tool use data table 2017-09-19 16:09:36 +02:00
John Chilton 57ff68edd0 Merge pull request #4539 from mvdbeek/purge_source
Prevent in-place editing of uploaded files if files are imported from the FTP folder
2017-09-07 10:11:04 -04:00
Dannon Baker d887cb17f0 Merge join_header into dev. 2017-09-06 20:35:33 -04:00
mvdbeek cccf79ac5f Make bz2file dependency conditional on python being below version 3.3 2017-09-05 18:30:25 +02:00
mvdbeek 46c85ffa98 Allow working with pbzip2 compressed files
This adds supprt for uploading and uncompressing pbzip2 compressed
files by exchanging the bz2 module with bz2file (recommended as workaround in
https://docs.python.org/2/library/bz2.html). The problem was reported by
@alpapan in #4538 and this commit should fix #4538.

Depends on https://github.com/galaxyproject/starforge/pull/147 for the
bz2file wheel.
2017-09-05 16:54:34 +02:00
mvdbeek 06db29413e Move instead of copying converted datasets when possible
shutil.move tries to move files by renaming them.  If that fails with
OSError (due to permission or cross-filesystem rename) it falls back to
copying files followed by removing them
(https://github.com/python/cpython/blob/2.7/Lib/shutil.py#L279). By
using shutil.move and catching permission problems we avoid an
unnecessary copy if source and destination are on the same filesystem.

Also avoids shutil.move if the upload tool is run as real-user which
should fix https://github.com/galaxyproject/galaxy/issues/4300.
2017-09-03 12:03:36 +02:00
mvdbeek 62ef8b52ae Fix sniffing for non-binary files 2017-09-03 10:49:23 +02:00
mvdbeek 14497719ba Prevent in-place editing if purge_source is false
When importing files from the FTP folder the admin can choose to prevent
purging of imported files. In this case the source file should not be
modified in-place by galaxy.

This also modifies relevant bare `except:` statements and modifies
the meaning of `in_place` in upload.py from no external chown script to
do not edit files in place if we keep the source file.

This fixes https://github.com/galaxyproject/galaxy/issues/4527.
2017-09-03 09:48:39 +02:00
John Chilton 5a7a15d161 Test and clarifications for composite uploads.
- Add an API test for datatype-defined composite uploads - including exercising newline conversion and the space_to_tab parameter.
- Add a test decorator skip_without_datatype to mirror skip_without_tool for this test, improve both decorators.
- The ftype parameter in the composite test tools does nothing - drop it and drop it from the XSD spec.
- Slightly improve the documentation for these composite_data elements in the XSD.
2017-08-31 12:47:40 -04:00
Nuwan Goonasekera 52b26f45a2 Registered genomespace_importer as a tool needing Galaxy's python env 2017-08-19 00:38:08 +05:30
Nuwan Goonasekera 3e8bf3c4e7 Moved genomespace token to environment variable 2017-08-19 00:38:08 +05:30
Nuwan Goonasekera 46dc4a252c Fixed template formatting according to review comments 2017-08-19 00:38:08 +05:30
Nuwan Goonasekera b73e21b584 Formatting and linting fixes for GenomeSpace tool 2017-08-19 00:38:07 +05:30
Nuwan Goonasekera 517fd23fc8 Fixed typo in exporter help text 2017-08-19 00:38:07 +05:30
Nuwan Goonasekera 678d575a7a Improved recognition of compressed files 2017-08-19 00:38:07 +05:30
Nuwan Goonasekera 46c04dcbd4 Fix incorrect reference when determining file type through file ext 2017-08-19 00:38:07 +05:30
Nuwan Goonasekera cb1b086324 Fixed pylint errors 2017-08-19 00:38:07 +05:30
slugger70 b04ccbe55b Fixed genomespace_importer.xml command block 2017-08-19 00:38:06 +05:30
Nuwan Goonasekera ad1b613445 Added support for pushing multiple files from GenomeSpace to Galaxy. 2017-08-19 00:38:06 +05:30
Nuwan Goonasekera e39901ef06 Moved back some code to wrapper and added back data type sniffing. 2017-08-19 00:38:06 +05:30
Nuwan Goonasekera 1342c2bd70 Integrated File Browsing and Workflow support for GenomeSpace 2017-08-19 00:38:06 +05:30
John Chilton 0fa287f76a Add autopep8 script to help rebasing branches after #4440.
Fixes a few more PEP8 issues as part of the autopep8'ing as well.
2017-08-17 13:47:03 -04:00