weaver.wps.service

Module Contents

weaver.wps.service.LOGGER[source]
class weaver.wps.service.WorkerRequest(http_request: Optional[weaver.typedefs.AnyRequestType] = None, http_headers: Optional[weaver.typedefs.AnyHeadersContainer] = None, **kwargs: Any)[source]

Extended pywps request with additional handling provided by weaver.

_auth_headers[source]
parse_auth_headers(headers: Optional[weaver.typedefs.AnyHeadersContainer]) weaver.typedefs.HeadersType[source]
class weaver.wps.service.WorkerExecuteResponse(wps_request: WorkerRequest, uuid: str, process: pywps.app.Process, job_url: str, settings: weaver.typedefs.SettingsType, *_: Any, **__: Any)[source]

XML response generator from predefined job status URL and executed process definition.

constructor

Parameters
  • wps_request (pywps.app.WPSRequest.WPSRequest) –

  • process (pywps.app.Process.Process) –

  • uuid – string this request uuid

class weaver.wps.service.WorkerService(*_: Any, is_worker: bool = False, settings: weaver.typedefs.SettingsType = None, **__: Any)[source]

Dispatches PyWPS requests from WPS-1/2 XML endpoint to WPS-REST as appropriate.

Note

For every WPS-Request type, the parsing of XML content is already handled by the PyWPS service for GET/POST. All data must be retrieved from parsed WPSRequest to avoid managing argument location and WPS versions.

When GetCapabilities or DescribeProcess requests are received, directly return to result as XML based on content (no need to subprocess as Celery task that gets resolved quickly with only the process(es) details). When JSON content is requested, instead return the redirect link to corresponding WPS-REST API endpoint.

When receiving Execute request, convert the XML payload to corresponding JSON and dispatch it to the Celery Worker to actually process it after job setup for monitoring.

_get_capabilities_redirect(wps_request: pywps.app.WPSRequest, *_: Any, **__: Any) Optional[Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid]][source]

Redirects to WPS-REST endpoint if requested Content-Type is JSON.

get_capabilities(wps_request: pywps.app.WPSRequest, *_: Any, **__: Any) Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid][source]

Handles the GetCapabilities KVP/XML request submitted on the WPS endpoint.

Redirects to WPS-REST endpoint if requested Content-Type is JSON or handle GetCapabilities normally.

_describe_process_redirect(wps_request: pywps.app.WPSRequest, *_: Any, **__: Any) Optional[Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid]][source]

Redirects to WPS-REST endpoint if requested Content-Type is JSON.

describe(wps_request: pywps.app.WPSRequest, *_: Any, **__: Any) Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid][source]

Handles the DescribeProcess KVP/XML request submitted on the WPS endpoint.

Redirect to WPS-REST endpoint if requested Content-Type is JSON or handle DescribeProcess normally.

_submit_job(wps_request: pywps.app.WPSRequest) Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid, weaver.typedefs.JSON][source]

Dispatch operation to WPS-REST endpoint, which in turn should call back the real Celery Worker for execution.

Returns the status response as is if XML, or convert it to JSON, according to request Accept header.

prepare_process_for_execution(identifier: str) pywps.app.Process[source]

Handles dispatched remote provider process preparation during execution request.

execute(identifier: str, wps_request: Union[pywps.app.WPSRequest, WorkerRequest], uuid: str) Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid][source]

Handles the Execute KVP/XML request submitted on the WPS endpoint.

Submit WPS request to corresponding WPS-REST endpoint and convert back for requested Accept content-type.

Overrides the original execute operation, that will instead be handled by execute_job() following callback from Celery Worker, which handles process job creation and monitoring.

If Accept is JSON, the result is directly returned from _submit_job(). If Accept is XML or undefined, WorkerExecuteResponse converts the received JSON with XML template.

execute_job(job: Ellipsis, wps_inputs: List[weaver.typedefs.WPS_InputData], wps_outputs: List[weaver.typedefs.WPS_OutputRequested], remote_process: Optional[weaver.datatype.Process], headers: Optional[weaver.typedefs.AnyHeadersContainer]) owslib.wps.WPSExecution[source]

Real execution of the process by active Celery Worker.

weaver.wps.service.get_pywps_service(environ: weaver.typedefs.SettingsType = None, is_worker: bool = False) WorkerService[source]

Generates the PyWPS Service that provides WPS-1/2 XML endpoint.