-
Notifications
You must be signed in to change notification settings - Fork 117
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
NetCDF and OPeNDAP complex validators #394
Conversation
@huard I'm testing it :) codacy has complains about imports. One is relevant (unused exception). Maybe we can ignore the netcdf import complain ... or do it in a different way. |
I'm using the validation mode with Emu. When I use an invalid input for OpenDAP (or NetCDF) the exception is not handled in the validator ... it should probably catch it and say the input is invalid, like here (opendap):
|
Good point, will update the PR. |
I get an exception when I define the |
Are you using default_type=SOURCE_TYPE.URL ? |
The default source_type is DATA in pywps, so here we need to change it to URL to avoid this error. We should think of a way to handle this more gracefully. |
I pushed to emu with a fix. |
The default handling question raises an issue I hadn't thought about. At the moment the default is set at the creation of ComplexInput, using the default source type, which is DATA. Whatever the default value, I can think of cases where the user request source type would be different from the default value. But changing the source type is not supported by IOHandler. I see two options, 1. add support for source type changes in IOHandler, 2. defer the setting of the default value until after the user request, when we know no values were provided and we need to actually set the object to its default value. I'd tend to go for the second option to avoid triggering actions (downloads, copies) for nothing. |
From your explanation I also would prefer option 2. But changing the handling of the default value looks like quite some refactoring. Also we could then skip the @jachym what is your opinion on this? The default will be set when a request comes in (if necessary) to make the |
@huard another thing I stumbled on. The setter for the default value does not know the URL type: Line 193 in 1356504
When I add it then I run into more issues. The validator triggers a download to the
|
@cehbrecht Unless I'm wrong, it's a two line change to defer the evaluation of ComplexInput. I'll push the commit so you can take a look. I've also fixed the missing URL setting which I also ran into yesterday. |
@huard It works :) If I understand it correctly you store the default in Shall we set the Still there are things to clean up and fix for defaults:
Shall we open another ticket for this? |
Correct. I agree it would make sense to make changes to the default_type mechanisms, but I didn't want to break anything. I suppose it would be cleaner to make a separate PR with changes to default handling, but I can try to fix the describeprocess issue in this PR. |
In the json property I could add:
so that default values are set before creating the json representation. There is another issue with the json property: it accesses ComplexInput.file, which for a URL input would trigger a download. What about when the source is DATA, does it make sense to return the link to the file when the json already include the data itself ? Also, having to return the file created from a default value requires a workdir to be defined, which is not set before execution time. This case does not seem to be exercised in test_describe. One option would be in the json property to do: |
@huard I would not trigger http://www.opengeospatial.org/standards/wps (wps 1.0.0, table 21). That was wishful thinking ;) |
…g default twice for bbox and literal
Ok, then I think we have a working version, with the caveat that a source_type clean-up remains to be done. |
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.
PR looks fine and tested with Emu WPS. Remaining changes for default value handling are coming with a new PR.
@huard checked again and merged. Thanks :) |
Overview
Related Issue / Discussion
#152
Additional Information
Entails a dependency on netCDF (optional).
There is no change to the docs as this is not really discussed anywhere.
Contribution Agreement
(as per https://github.com/geopython/pywps/blob/master/CONTRIBUTING.rst#contributions-and-licensing)