-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[23.2] Expose file_name property in DatasetFilenameWrapper #17107
[23.2] Expose file_name property in DatasetFilenameWrapper #17107
Conversation
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.
Looks good, but can you use this in one of the framework tool tests ?
I don't think this is correct, but any way, wouldn't it be easier to revert this part: c30a4c0#diff-01abdfd70033a33dfc2f945458e601e0418956e036ace05bebaf1ed8c4e263e8L474-R476 |
That would probably only work with |
That was my initial thought before looking at the commit history, it should be fine as well. |
@nsoranzo Reverting that part does not fix it, rather it causes the test to fail in a new way (that I cannot understand yet, but certainly caused by a filename error). The property approach works, at least for my test case. I'll add a framework test to expose this, which will also help me better understand how this is supposed to work. Can you elaborate on why you think the proposed solution may be incorrect? (I'm not disagreeing - just trying to better understand the problem). |
I think the correct fix is: diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py
index 9e59536c65..12094585da 100644
--- a/lib/galaxy/tools/wrappers.py
+++ b/lib/galaxy/tools/wrappers.py
@@ -464,6 +464,9 @@ class DatasetFilenameWrapper(ToolParameterValueWrapper):
)
return self.dataset.datatype.matches_any(datatypes)
+ @property
+ def file_name(self) -> str:
+ return str(self)
+
def __str__(self) -> str:
if self.false_path is not None:
return self.false_path
@@ -471,10 +474,7 @@ class DatasetFilenameWrapper(ToolParameterValueWrapper):
return str(self.unsanitized.get_file_name())
def __getattr__(self, key: Any) -> Any:
- if self.false_path is not None and key == "get_file_name":
- # Path to dataset was rewritten for this job.
- return lambda *args, **kwargs: self.false_path
- elif key in ("extra_files_path", "files_path"):
+ if key in ("extra_files_path", "files_path"):
if not self.compute_environment:
# Only happens in WrappedParameters context, refactor!
return self.unsanitized.extra_files_path
You're right, but it works in a convoluted way. |
The simplified call in the property works fine, but we can't drop the if statement from |
Isn't the use of |
Sorry, I am confused. I thought that wrapper provides access to all attributes of a dataset, including |
The wrapper expose only selected properties that can be used when writing the Cheetah command section of a Galaxy tool. This is not documented anywhere in full, you can find examples of |
test failure relevant. |
d172f1c
to
a216124
Compare
Should also galaxy/test/unit/app/tools/test_wrappers.py Line 210 in a216124
|
a216124
to
33ccacf
Compare
Yes, thank you! |
Fixes #17098.
How to test the changes?
(Select all options that apply)
License