Skip to content

Submit a processing job on Ades v2 copy

bbrauzzi edited this page Oct 4, 2023 · 1 revision

Prepare the job order payload

A HTTP POST request to the execution-endpoint creates a new job. The inputs and outputs need to be passed in a JSON execute-request.

Method Path Headers Status Code
POST /{WORKSPACE_NAME}/wps3/processes/{PROCESS_ID}
  • Accept: application/json
  • Content-Type: application/json
  • (Optional) Authorization: Bearer ***
201

Request payload body:

{
  "inputs": {
      "input1": "input1_value1",
      "input2_array":[
          "input2_value1",
          "input2_value2"
      ]
  }
}

App execution example:

We first create the job order JSON file app-deploy-payload.json describing our input parameters following thew input specification from the processing services description.

{
  "inputs": {
      "input_reference": "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2B_36RTT_20191205_0_L2A",
      "s_expression":[
          "nbr:(/ (- B05 B02) (+ B05 B02))",
          "ndvi:(/ (- B05 B03) (+ B05 B03))"
      ]
  }
}

We then submit the job order with a curl command line using the OGC API interface

curl -v -L -X POST "http://{HOSTNAME:PORT}/{WORKSPACE_NAME}/wps3/processes/snuggs-0_3_0/jobs" \
    -H "accept: application/json" -H  "Prefer: respond-async" -H  "Content-Type: application/json" -d "@test/sample_apps/v2/snuggs/app-execute-payload.json"

The command line's result should be similar to

TODO << place here the response with the redirect to the get status >>

The server replied with a HTTP 201 created acknowledging the job sucessfully created. It also contains a redirect link to the job on the ADES

We also can see the newly created job by querying the current job list.

curl -s -L "http://{HOSTNAME:PORT}/{WORKSPACE_NAME}/wps3/jobs" -H "accept: application/json"

And the result should include a new job with the same identifier returned by the job submission query

{
    "jobs": [
        {
            "progress": 50,
            "jobID": "76d50612-513d-11ed-888e-32db482e8b42",
            "status": "running",
            "message": "running",
            "links": [
                {
                    "title": "Status location",
                    "rel": "status",
                    "type": "application/json",
                    "href": "/terradue/wps3/jobs/76d50612-513d-11ed-888e-32db482e8b42"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "self",
            "type": "application/json",
            "href": "/terradue/wps3/jobs"
        }
    ],
    "numberTotal": 1
}

We can see 2 links in the response:

  1. A status location where we can poll regurarly the status of this job

    curl -s -L "http://{HOSTNAME:PORT}/{WORKSPACE_NAME}/wps3/jobs/76d50612-513d-11ed-888e-32db482e8b42" -H "accept: application/json"
  2. A result location available when the job is complete

    curl -s -L "http://{HOSTNAME:PORT}/{WORKSPACE_NAME}/wps3/jobs/76d50612-513d-11ed-888e-32db482e8b42/results" -H "accept: application/json"

This last link will return the following response when the job is complete.

{
    "outputs": [
        {
            "id": "wf_outputs",
            "time": "2021-09-30T16:03:42.801714Z",
            "value": {
                "inlineValue": "{\"StacCatalogUri\": \"s3://processingresults/wf-76d50612-513d-11ed-888e-32db482e8b42/catalog.json\"}"
            }
        }
    ]
}

It includes a link to the catalog entry of the result and a link to the resource manager hosting the processing results.

Get Job List

Method Path Status Code
GET /{WORKSPACE_NAME}/wps3/jobs 200

Get Status

Method Path Status Code
GET /{WORKSPACE_NAME}/wps3/jobs/{JOB_ID} 200

Get Results

Method Path Status Code
GET /{WORKSPACE_NAME}/wps3/jobs/{JOB_ID}/results 200