-
Notifications
You must be signed in to change notification settings - Fork 991
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
Fix MetadataValidator #13139
Fix MetadataValidator #13139
Conversation
If no check or skip is given, self.check and self.skip need to be initialised to None. Otherwise validation with `value.missing_meta(check=self.check, skip=self.skip)` is called with `value.missing_meta(check=[""], skip=[""])`. This led to the stalling observed in galaxyproject#13136 Explanation: each data input parameter automatically gets a MetadataValidator. Since this validator was dysfunctional the job was scheduled anyway, but did not execute.
Can you add a test here ? |
Also thought that this would be a good idea. Will try. |
disable the MetadataValidator that is added to data params by default by adding `no_validation="true"` to the test parameters. (see https://github.com/galaxyproject/galaxy/blob/bc939ca4e0f0404a20d2cd3fbcc922768c195c08/lib/galaxy/tools/parameters/basic.py#L1898) Since the default is initialised with MetadataValidator() the message was None. Now message is also initialised in __init__. Analoguous change in DatasetOkValidator, UnspecifiedBuildValidator.
You can replace all the diff --git a/lib/galaxy/datatypes/data.py b/lib/galaxy/datatypes/data.py
index f7bc205d94..f3862a60e4 100644
--- a/lib/galaxy/datatypes/data.py
+++ b/lib/galaxy/datatypes/data.py
@@ -240,7 +240,7 @@ class Data(metaclass=DataMeta):
for key, value in to_check:
if key in skip or (not check and dataset.metadata.spec[key].get("optional")):
continue # we skip check for optional and nonrequested values here
- if not value:
+ if value is None:
return True
return False
Values like 0, |
Yes :) I just realized this as well. Not sure yet if I will keep it anyway, because removing the default metadata validator makes debugging the tests a bit easier ..
Hah, just stumbled over the same point. Intuitively I thought that we should check if the value is the |
the `missing_meta` function skipped optional metadata if `skip` was provided. Note skip only makes sense for optional metadata since non-optional metadata is validated by the default metadata validator (which uses check=None and skip=None). In `missing_meta`: allow for 0, "", and None as valid metadata. Fix tests for metadata validator: - use test-data from GALAXY_ROOT/test-data/ - use real (optional) metadata for check and skip Co-authored-by: Nicola Soranzo <nicola.soranzo@earlham.ac.uk>
I'd not use |
bf60035
to
9b44643
Compare
Spent quite a bit of time thinking about this. While formally correct the statement is not specific enough to ensure if a metadata element is set or not. In my test the tool did still stall, i.e. the failing I think the it might be the best to check if the value is equal to Unfortunately, apart from the commit message of the original commit Essentially we should "ensure" (at least in the datatype definitions) that Besides this I was wondering if the test I was also wondering if it wouldn't be better to fail the upload job if metadata setting fails. |
9b44643
to
e7df147
Compare
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
using the element_is_set function
since its the default
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
…tthias/galaxy into fix/metadata-validation
- make missing_meta return missing metadata keys / False - include missing metadata name in MetadataValidator error - proper messages for failing negated MetadataValidator - reuse item getter in element_is_set
because it clearly is optional (in particular because default == no_value)
biom2 sets either format of format_version. since the metadata elements are not optional we should just set both to the same value
0be1802
to
347e9fe
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.
Is this ready ?
With an approval of @nsoranzo yes :) |
If no
check
orskip
attribute is given,self.check
andself.skip
need to be initialized toNone
. Otherwise validation withvalue.missing_meta(check=self.check, skip=self.skip)
is called withvalue.missing_meta(check=[""], skip=[""])
.This led to the stalling observed in #13136
Explanation: each data input parameter automatically gets a
MetadataValidator
. Since this validator was dysfunctional the job was scheduled anyway, but did not execute.Appears that the validator might have been dysfunctional for a long time (since
check
andskip
have been introduced here: bernt-matthias@b9e242e)How to test the changes?
(Select all options that apply)
License