-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Workflow execution may take several hours to run. Thus, we need a mechanism to start a job and to notify the user after its completion. Fortunately, pygeoapi has a job manager already. Async mode can be requested by adding an HTTP header.
- Execute the process in OGC API and request async mode by adding a header
- Header of the response will contain the job id
- We can request status and results using this job ID
curl -i -X POST http://localhost/processes/hello-world/execution \
-H "Content-Type: application/json" \
-H "Prefer: respond-async" \
-d "{\"inputs\":{\"message\": \"Hello\", \"name\": \"world\"}}"
HTTP/1.1 201 CREATED
Server: gunicorn
Date: Wed, 04 Dec 2024 13:47:05 GMT
Connection: keep-alive
Content-Type: application/json
X-Powered-By: pygeoapi 0.18.0
Content-Language: en-US
Preference-Applied: respond-async
Location: /jobs/3f6a4e28-b246-11ef-8a79-0242ac1a0002
Access-Control-Allow-Origin: *
Content-Length: 4
curl http://localhost/jobs/3f6a4e28-b246-11ef-8a79-0242ac1a0002
{
"type":"process",
"processID":"hello-world",
"jobID":"3f6a4e28-b246-11ef-8a79-0242ac1a0002",
"status":"successful",
"message":"Job complete",
"progress":100,
"parameters":null,
"job_start_datetime":"2024-12-04T13:47:05.316464Z",
"job_end_datetime":"2024-12-04T13:47:05.327997Z",
"links":[
{
"href":"/jobs/3f6a4e28-b246-11ef-8a79-0242ac1a0002/results?f=html",
"rel":"http://www.opengis.net/def/rel/ogc/1.0/results",
"type":"text/html",
"title":"Results of job as HTML"
},
{
"href":"/jobs/3f6a4e28-b246-11ef-8a79-0242ac1a0002/results?f=json",
"rel":"http://www.opengis.net/def/rel/ogc/1.0/results",
"type":"application/json",
"title":"Results of job as JSON"
}
]
}%
curl http://localhost/jobs/3f6a4e28-b246-11ef-8a79-0242ac1a0002/results\?f\=json
{
"id": "echo",
"value": "Hello world! Hello"
}%
Metadata
Metadata
Assignees
Labels
No labels