-
Notifications
You must be signed in to change notification settings - Fork 42
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 Process function generation #40
Comments
This is an old issue, but it's becoming more important as time passes since back-ends have more functionality now. |
I think there are 2 separate aspects to this:
Concerning 1.: I'm not a big of dynamic generation of functions/methods as this breaks some features that are important for the end user: normal discovery and documentation of methods (by looking at the source code of ImageCollectionClient, or using the code inspection features of their IDE), straightforward exceptions and backtraces when something goes wrong, lower barrier to entry to contribute/fix things, .... An alternative solution for 1. is still using traditional hardcoded methods but using unit tests that compare the openEO API description with the available methods of ImageCollectionClient and fail when something is missing. We are using this approach in the python driver to support dedicated python exceptions for each openEO error code (as defined in https://open-eo.github.io/openeo-api/errors/):
That being said, there are probably some ways to reduce the necessary boilerplate code and overhead to implement a process as a method in the client. About 2.: this should be relatively straightforward to implement. It should be optional at the moment however, because probably not all backends properly declare which processes are supported in the capabilities endpoint (the VITO backend doesn't for example) |
There exists a way to add custom/unsupported processes: Perhaps we need to improve documentation so that people find it more easily? About dynamically generated processes, I agree with Stefaan. I would however not object to someone showing how this can be done in the python client (as a separate way of building process graphs, separate from the ImageCollection class). |
I'll investigate on possible dynamic generation strategies in the "process_generation" branch. |
So I worked on that issue now for a while, and haven't found a working suitable solution to dynamically generating processes using the Python client other than doing it myself. |
Interesting work, |
Some points to consider from today's discussion: Issues static:
Issues dynamic:
In my opinion, the basic functionality (e.g. load_collection, filters) should be static for convenience reasons. Other things should be dynamically generated (e.g. custom processes). The main issue is to decide where to draw the line on what should be static or not. |
adds a property `dynamic` to ImageCollectionClient instances, which allows to call processes that are dynamically detected from the backend process listing (and not necessarily predefined in the client)
adds a property `dynamic` to ImageCollectionClient instances, which allows to call processes that are dynamically detected from the backend process listing (and not necessarily predefined in the client)
Inspired by yesterday's discussion I also played a bit with the following idea: add a property The basic unit test shows how it is intended to work:
Some notes:
|
In general I like this, but I don't think a user cares about whether something is dynamic or hard-coded. That should be completely hidden at best and simply be
If we need such a "prefix": custom? proprietary? From the API perspective there are in general two kind of processes:
If required, you could split predefined into two categories
|
Since the back ends may be capable of a different amount of processes and they can be retrieved by the GET /processes end point, it would be a major improvement to generate the process functions dynamically when a back end provider is chosen.
e.g.: https://stackoverflow.com/questions/23812760/dynamic-functions-creation-from-json-python
It is at least something I want to look into.
The text was updated successfully, but these errors were encountered: