Skip to content

Commit

Permalink
ogc api processes subscriber (geopython#1313)
Browse files Browse the repository at this point in the history
* Exclude None from `get_processor` return type annotation

An exception is raised in case of error, so it can't ever return None

* Add support for OGC API Processes Subscriber

The subscription URLs are passed to the manager, which
then has to call them appropriately.

By default, managers have the attribute `supports_subscribing`
set to `False` in order to not break the API for these. The
subscriptions are only passed to if this is set to `True`

* Add ogc api callback class to conformance

https://docs.ogc.org/is/18-062r2/18-062r2.html#toc67

* Make successUri mandatory in subscriber

It's mandatory in the standard.

Thx @ricardogsilva !

* Use snake case in python for fields which are camel case in the api

Thx @ricardogsilva !

* Add subscriber to method docstring

* Provide default value for subscriber for managers not supporting it

Thanks @ricardogsilva !

* Factor out notification call into methods

This increases reusability by other managers

Thanks @ricardogsilva !

* Add an example call for a process subscriber

* Change test urls to valid urls

* Third party imports in own block
  • Loading branch information
totycro authored and tomkralidis committed Mar 26, 2024
1 parent af38787 commit 94b3a87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/source/data-publishing/ogcapi-processes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ Processing examples
-H "Prefer: respond-async"
-d "{\"inputs\":{\"name\": \"hi there2\"}}"
# execute a job for the ``hello-world`` process with a success subscriber
# execute a job for the ``hello-world`` process with a success subscriber
curl -X POST http://localhost:5000/processes/hello-world/execution \
-H "Content-Type: application/json" \
-d "{\"inputs\":{\"name\": \"hi there2\"}, \
\"subscriber\": {\"successUri\": \"https://www.example.com/success\"}}"
.. _`OGC API - Processes`: https://ogcapi.ogc.org/processes
.. _`sample`: https://github.com/geopython/pygeoapi/blob/master/pygeoapi/process/hello_world.py
.. _`TinyDB`: https://tinydb.readthedocs.io/en/latest
2 changes: 2 additions & 0 deletions pygeoapi/process/manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ def _execute_handler_sync(self, p: BaseProcessor, job_id: str,
self.update_job(job_id, job_metadata)
self._send_failed_notification(subscriber)

self._send_failed_notification(subscriber)

return jfmt, outputs, current_status

def execute_process(
Expand Down

0 comments on commit 94b3a87

Please sign in to comment.