Module Contents

weaver.wps_restapi.jobs.utils.get_job(request: weaver.typedefs.PyramidRequest) weaver.datatype.Job[source]

Obtain a Job from request parameters.

Changed in version 4.20: When looking for Job that refers to a local Process, allow implicit resolution of the unspecified version portion to automatically resolve the identifier. Consider that validation of the expected Process for this Job is “good enough”, since the specific ID is not actually required to obtain the Job (could be queried by ID only on the /jobs/{jobId} endpoint. If the version is provided though (either query parameter or tagged representation), the validation will ensure that it matches explicitly.


request – Request with path and query parameters to retrieve the desired job.


Job information if found.


HTTPNotFound – with JSON body details on missing/non-matching job, process, provider IDs.

Obtains a list of all relevant links for the corresponding job listing defined by query parameter filters.


IndexError – if the paging values are out of bounds compared to available total Job matching search.

weaver.wps_restapi.jobs.utils.get_schema_query(schema: weaver.processes.constants.JobInputsOutputsSchemaType | None, strict: bool = True) weaver.processes.constants.JobInputsOutputsSchemaType | None[source]

Convert a result definition as value into the corresponding reference for output transmission.

See also

RFC 8288: HTTP Link header specification.

weaver.wps_restapi.jobs.utils.get_results(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer, value_key: str | None = None, schema: weaver.processes.constants.JobInputsOutputsSchemaType = JobInputsOutputsSchema.OLD, link_references: bool = False) Tuple[weaver.typedefs.ExecutionResults, weaver.typedefs.HeadersTupleType][source]

Obtains the job results with extended full WPS output URL as applicable and according to configuration settings.

  • job – job from which to retrieve results.

  • container – any container giving access to instance settings (to resolve reference output location).

  • value_key – If not specified, the returned values will have the appropriate data/href key according to the content. Otherwise, all values will have the specified key.

  • schema – Selects which schema to employ for representing the output results (listing or mapping).

  • link_references – If enabled, an output that was requested by reference instead of by value will be returned as Link header.


Tuple with:
  • List or mapping of all outputs each with minimally an ID and value under the requested key.

  • List of Link headers for reference outputs when requested. Empty otherwise.

weaver.wps_restapi.jobs.utils.get_job_results_response(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer, headers: weaver.typedefs.AnyHeadersContainer | None = None) weaver.typedefs.AnyResponseType[source]

Generates the OGC compliant Job results response according to submitted execution parameters.

Parameters that impact the format of the response are:
  • Amount of outputs to be returned.

  • Parameter response: raw|document

  • Parameter transmissionMode: value|reference per output if response: raw.

  • job – Job for which to generate the results response.

  • container – Application settings.

  • headers – Additional headers to provide in the response.

weaver.wps_restapi.jobs.utils.get_job_submission_response(body: weaver.typedefs.JSON, headers: weaver.typedefs.AnyHeadersContainer, error: bool = False) pyramid.httpexceptions.HTTPOk | pyramid.httpexceptions.HTTPCreated[source]

Generates the successful response from contents returned by Job submission process.

If Job already finished processing within requested Prefer: wait=X seconds delay (and if allowed by the Process jobControlOptions), return the successful status immediately instead of created status.

Otherwise, return the status monitoring location of the created Job to be monitored asynchronously.

weaver.wps_restapi.jobs.utils.validate_service_process(request: weaver.typedefs.PyramidRequest) Tuple[str | None, str | None][source]

Verifies that any Provider or Process specified by path or query are valid.


HTTPException – Relevant HTTP error with details if validation failed.


Validated and existing service and process if specified.

weaver.wps_restapi.jobs.utils.raise_job_bad_status(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer | None = None) None[source]

Raise the appropriate message for Job not ready or unable to retrieve output results due to status.

weaver.wps_restapi.jobs.utils.raise_job_dismissed(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer | None = None) None[source]

Raise the appropriate messages for dismissed Job status.

weaver.wps_restapi.jobs.utils.dismiss_job_task(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer) weaver.datatype.Job[source]

Cancels any pending or running Celery task and removes completed job artifacts.


The Job object itself is not deleted, only its artifacts. Therefore, its inputs, outputs, logs, exceptions, etc. are still available in the database, but corresponding files that would be exposed by weaver.wps_output configurations are removed.

  • job – Job to cancel or cleanup.

  • container – Application settings.


Updated and dismissed job.