bird-house / emu

PyWPS processes for testing and demo.
http://emu.readthedocs.io/en/latest/
Other
3 stars 10 forks source link

Defining WPS profiles in PyWPS #79

Open cehbrecht opened 5 years ago

cehbrecht commented 5 years ago

Description

It happens quite often that we have a set of processes with common input (and output) parameters. In WPS the process signature (inputs+outputs) is called a profile (I think). To avoid copy+paste of this process parameters one could use Python decorators or mixin classes to define a commonly used profile which can be adapted by each individual process.

Here are some examples how it could look like:

Environment

Steps to Reproduce

Additional Information

huard commented 5 years ago

I like the mixins, but my concern is that relatively few developers will be familiar with this. In other words, it might look a bit too much like magic. What I've started doing is simply create a module with all the common inputs and outputs used throughout the different WPS processes (wpsio.py). For a given Process definition, I then just import wpsio and refer to the objects in the inputs and outputs fields of the Process.init. See https://github.com/Ouranosinc/raven/blob/master/raven/processes/wps_regionalisation.py for an example.

cehbrecht commented 5 years ago

I have updated the docs (see PR) with mentioned examples. Notebooks are moved to birdhouse:

https://github.com/bird-house/notebooks/tree/master/pywps-profiles

I have added an example with a simple shared profile, similar to the example by @huard, which provides an optional decorator for convenience:

https://github.com/bird-house/notebooks/blob/master/pywps-profiles/notebooks/process_simple_profile_and_decorator.ipynb