-
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
Dynamic options: add data table filter #12941
base: dev
Are you sure you want to change the base?
Dynamic options: add data table filter #12941
Conversation
f99c729
to
725f3c2
Compare
725f3c2
to
d608ba1
Compare
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.
This is really cool, but from_file
should not be able to reference files outside of the tool dir.
<inputs> | ||
<param name="dynamic_select" type="select"> | ||
<!-- initialize options from file (contains all entries that could be added to the data table) --> | ||
<options from_file="../test/functional/tool-data/test_file.tsv"> |
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.
That's a security issue and should not work.
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.
Do you have an idea how to specify another dir during tests, eg test/functional/tool-data/
?
I guess we can check if os.path.abspath(path)
startswith the tool-data
dir... could do this in another PR.
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.
It's fine to do this in another PR, but we shouldn't merge this before we sorted that out.
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.
Also there is a safe_contains
function in galaxy.util you can use
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.
ae4c401 contains a possible solution for:
Do you have an idea how to specify another dir during tests, eg test/functional/tool-data/?
Any comments?
if not os.path.isabs(data_file): | ||
full_path = os.path.join(self.tool_param.tool.app.config.tool_data_path, data_file) | ||
full_path = os.path.join(self.tool_param.tool.app.config.tool_data_path, data_file) | ||
full_path = os.path.normpath(full_path) |
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.
Is the normpath call necessary here ? safe_contains
should be smart enough to figure this out, and joining with cwd
for non-absolute paths does not seem right (that seems to be what normpath does internally).
@@ -60,7 +60,7 @@ def setUp(self): | |||
self.galaxy_url = f"http://{self.galaxy_host}:{self.galaxy_port}" | |||
self.shed_tool_data_table_conf = os.environ.get('TOOL_SHED_TEST_TOOL_DATA_TABLE_CONF') | |||
self.file_dir = os.environ.get('TOOL_SHED_TEST_FILE_DIR', None) | |||
self.tool_data_path = os.environ.get('GALAXY_TEST_TOOL_DATA_PATH') | |||
self.tool_data_path = os.environ.get('GALAXY_TEST_TOOL_DATA_PATH', 'test/functional/tool-data/') |
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.
If that's necessary for tests to pass I think it likely alerts to the fact that this would break under other circumstances as well.
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.
Found no other way to get the functional test working. But you are right, since there are probably other tests using data tables it makes one wonder why they are working.
I remember that the problem was that GALAXY_ROOT/tool-data
was used if I did not change this.
Maybe this is related to the other comment?
Any suggestions how to continue. I'm happy to try anything :)
8065a08
to
2a47e13
Compare
I'm bumping this to 22.05, we still need to figure out what's up with #12941 (comment) |
fix missing import
2a47e13
to
bce9300
Compare
There's a conflict here and I think the framework test failure is legitimate ? |
b973bd5
to
50ed0fe
Compare
50ed0fe
to
c1091c1
Compare
b65deda
to
e8a612b
Compare
In a recent gitter discussion (https://gitter.im/galaxy-iuc/iuc?at=6190aeff8c019f0d0b93414b) it was asked for a way to have a select list containing only elements that are not yet in a data table.. Et voila .. there is a data table filter.
The test tool shows how it might be used:
from_file
also had no test so far)For the first part I needed to apply a little hack:
from_file
seems to assume that the file is intool-data
in the Galaxy root. It would be much nicer if the file would be loaded from the dir (or atool-data
dir in this dir) containing the tool. Otherwise we would not meet the use case of the gitter discussion.I did not think about other possible use cases (e.g. intersections of data tables) and possibly needed attributes...
Ping @mvdbeek @pvanheus
The PR also adds more linting to filters.
How to test the changes?
(Select all options that apply)
License