Skip to content
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

Defining WPS profiles in PyWPS #79

Open
cehbrecht opened this issue Jan 31, 2019 · 2 comments
Open

Defining WPS profiles in PyWPS #79

cehbrecht opened this issue Jan 31, 2019 · 2 comments

Comments

@cehbrecht
Copy link
Member

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

  • Emu version used, if any:
  • Python version, if any:
  • Operating System:

Steps to Reproduce

Additional Information

@huard
Copy link
Contributor

huard commented Jan 31, 2019

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants