-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tool for exporting individual files to galaxy file source plugins. #11613
Conversation
tools/data_export/export_remote.xml
Outdated
#else: | ||
#set file_ext = $name.ext | ||
#end if | ||
'${name.element_identifier}.${file_ext}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmchilton Add tool wrapper support for doing this natively. If the extension is already included don't duplicate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like #3220 ? I was going to pick this back up, but let me know if you have other plans.
tools/data_export/export_remote.xml
Outdated
#if $name.ext == 'vcf_bgzip': | ||
#set file_ext = 'vcf.bz' | ||
#else: | ||
#set file_ext = $name.ext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmchilton Add datatype support this. Special case this in the datatype registry not in this tool.
@jmchilton one question that was coming up today is if we can add "create-folder" support. In the sense that we can select a folder from the For the FTP case we could do: from pathlib import Path
galaxy_files = "...."
ftp_path = "./foobra/foo/bar/foo.txt"
folder_path = Path(ftp_path).parent
a.makedirs(folder_path)
a.upload(ftp_path, galaxy_files) But how does the user set the ftp_path? |
@jmchilton @mvdbeek we need something like this soon on Main. Should I talk to Nate and get our tool into Main for the time being? |
a955607
to
f71bffd
Compare
That already works if the folder exists, you have to use the arrow icon on the right: What would be nice is if we can support creating the folder in the UI (and improve the navigation). |
Does that also work in a workflow? I couldn't get this working. But super cool if it does! |
It should, but maybe the editor doesn't play nice. I'll add some tests |
0660e88
to
59c3fd8
Compare
Stolen wholesale from EU. Trying to make it a bit more general though.
This avoids shell limits and quoting issues.
Now can't include leading `.`, `/` and utf null, and is truncated at 255 characters. Duplicate filenames will raise an error.
The tool now does what I'd like it do:
I did add a couple of new things that are available when templating commands or configfile sections.
These are available on wrapped collections:
I'm not sure I'm really happy with the added attributes on collections ... maybe for tools like this it'd be better to work with json_wrapped and then let the tool figure out what it wants to do with the collection ? |
Alright … I did enhance json_wrap, although I ended up not really using it for the tool. Instead I added a |
lib/galaxy/tool_util/xsd/galaxy.xsd
Outdated
paths for data parameters set the ``data_style`` attribute to ``paths`` (see [inputs_as_json_with_paths.xml](https://github.com/galaxyproject/galaxy/blob/dev/test/functional/tools/inputs_as_json_with_paths.xml) for an example). | ||
paths for data or collection inputs set the ``data_style`` attribute to ``paths`` (see [inputs_as_json_with_paths.xml](https://github.com/galaxyproject/galaxy/blob/dev/test/functional/tools/inputs_as_json_with_paths.xml) for an example). | ||
To include a dictionary with staging paths, paths and metadata files set the ``data_style`` attribute to ``staging_path_and_source_path``. | ||
An example tool that uses ``staging_path_and_source_path`` is [inputs_as_json_with_staging_path_and_source_path.xml](https://github.com/galaxyproject/galaxy/blobl/dev/test/functional/tools/inputs_as_json_with_staging_path_and_source_path.xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blobl
looks wrong.
@@ -0,0 +1,67 @@ | |||
<tool id="export_remote" name="Export datasets" version="0.1.0" profile="21.05"> | |||
<description>to remote files source</description> | |||
<!-- TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is still a TODO is that correct? Do we need to mark this tools as galaxy-env-tool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no package yet, but that would allow removing the tool id from https://github.com/galaxyproject/galaxy/pull/11613/files#diff-17974c8048767aa536063088ba97dbc9c4475e7589002c3b2335f9e8490fc920R129
This is not part of the PR anymore, left? This seems to be super useful, but IUC should look over it. E.g. the naming seems inconsistent. |
It's just renamed to
For collections:
On top of that there is the serialize() function that returns a dict (dataset) or list of dicts (collection) whose definition is
|
Restarted the test and its green now! |
Include a test tool that fails like this without the fix: ``` Traceback (most recent call last): File "/Users/mvandenb/src/galaxy/lib/galaxy/util/template.py", line 80, in fill_template return unicodify(t, log_exception=False) File "/Users/mvandenb/src/galaxy/lib/galaxy/util/__init__.py", line 1060, in unicodify value = str(value) File "/Users/mvandenb/src/galaxy/.venv/lib/python3.9/site-packages/Cheetah/Template.py", line 1053, in __unicode__ return getattr(self, mainMethName)() File "cheetah_DynamicallyCompiledCheetahTemplate_1631180564_759418_48584.py", line 89, in respond File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 342, in is_of_type datatype = self.datatypes_registry.get_datatype_by_extension(e) AttributeError: 'NoneType' object has no attribute 'get_datatype_by_extension' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/mvandenb/src/galaxy/lib/galaxy/jobs/runners/__init__.py", line 237, in prepare_job job_wrapper.prepare() File "/Users/mvandenb/src/galaxy/lib/galaxy/jobs/__init__.py", line 1160, in prepare self.command_line, self.extra_filenames, self.environment_variables = tool_evaluator.build() File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/evaluation.py", line 463, in build raise e File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/evaluation.py", line 459, in build self.__build_command_line() File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/evaluation.py", line 484, in __build_command_line command_line = fill_template(command, context=param_dict, python_template_version=self.tool.python_template_version) File "/Users/mvandenb/src/galaxy/lib/galaxy/util/template.py", line 118, in fill_template return fill_template(template_text=template_text, File "/Users/mvandenb/src/galaxy/lib/galaxy/util/template.py", line 126, in fill_template raise first_exception or e File "/Users/mvandenb/src/galaxy/lib/galaxy/util/template.py", line 80, in fill_template return unicodify(t, log_exception=False) File "/Users/mvandenb/src/galaxy/lib/galaxy/util/__init__.py", line 1060, in unicodify value = str(value) File "/Users/mvandenb/src/galaxy/.venv/lib/python3.9/site-packages/Cheetah/Template.py", line 1053, in __unicode__ return getattr(self, mainMethName)() File "cheetah_DynamicallyCompiledCheetahTemplate_1631180564_725492_78593.py", line 87, in respond File "/Users/mvandenb/src/galaxy/lib/galaxy/tools/wrappers.py", line 342, in is_of_type datatype = self.datatypes_registry.get_datatype_by_extension(e) AttributeError: 'NoneType' object has no attribute 'get_datatype_by_extension' ``` Broken in galaxyproject#11613
What did you do?
Why did you make this change?
How to test the changes?