-
Notifications
You must be signed in to change notification settings - Fork 50
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: raise errors when metadata discovery is not allowed #1534
base: develop
Are you sure you want to change the base?
Conversation
Code Coverage (Ubuntu)
Diff against develop
Results for commit: 774a65b Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Code Coverage (Windows)
Diff against develop
Results for commit: 774a65b Minimum allowed coverage is ♻️ This comment has been updated with latest results |
) | ||
else False | ||
) | ||
raise_mtd_discovery_error = ( |
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.
Logic is not correct when raise_mtd_discovery_error is is True for provider and False for product type.
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.
Done
@@ -1283,11 +1284,39 @@ def format_query_params( | |||
config.metadata_mapping, | |||
**config.products.get(product_type, {}).get("metadata_mapping", {}), | |||
) | |||
raise_mtd_discovery_error = ( |
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.
Please add some comments for this part of the code!
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.
Done!
it indicates whether metadata discovery may fail the search request or not
the case where raise_mtd_discovery_error was True at provider level and False at product type level was not handled
d894bc8
to
6ed5e38
Compare
6ed5e38
to
774a65b
Compare
Fixes #1531
For
MO_OCEANCOLOUR_GLO_BGC_L3_NRT_009_101
andMO_OCEANCOLOUR_GLO_BGC_L4_NRT_009_102
product types, the range was not wide enought and only very recent products are available.For
CLMS_CORINE
,wekeo
does not accept date parameters but does not raise an error. Then, it has been handled in two steps:startTimeFromAscendingNode
andcompletionTimeFromAscendingNode
are only mapped for this product type with this providerraise_mtd_discovery_error
has been set up indiscover_metadata.search_param
configuration. It is a boolean parameter, and if it is instantiated toTrue
and the user searches a product type with a parameter not among the queryables of this product type, an error is raised before the search request. It would make sure that the user knows his request is wrong instead of wondering the reason why he does have any result. The value by default ofraise_mtd_discovery_error
isFalse
. This keyword can be used at provider search plugin or at product type configuration level, the last one having the priority over the first one.Note: I chose to put
raise_mtd_discovery_error
atdiscover_metadata.search_param
level, but afterwards I am wondering if it should be better to put it atdiscover_metadata
level directly, likeauto_discovery
parameter.