weaver.processes.utils

Module Contents

weaver.processes.utils.LOGGER[source]
weaver.processes.utils._get_data(output: owslib.wps.Output) → Optional[Any][source]

Extract the data from the output value.

weaver.processes.utils._read_reference(url: AnyStr) → Optional[AnyStr][source]

Read a reference HTTP(S) URL and return the content.

weaver.processes.utils._get_multi_json_references(output: owslib.wps.Output, container: Optional[AnySettingsContainer]) → Optional[List[JSON]][source]

Since WPS standard does not allow to return multiple values for a single output, a lot of process actually return a json array containing references to these outputs.

Because the multi-output references are contained within this JSON file, it is not very convenient to retrieve the list of URLs as one always needs to open and read the file to get them. This function goal is to detect this particular format and expand the references to make them quickly available in the job output response.

Returns

Array of HTTP(S) references if the specified output is effectively a JSON containing that, None otherwise.

weaver.processes.utils.map_progress(progress: Number, range_min: Number, range_max: Number) → Number[source]

Calculates the relative progression of the percentage process within min/max values.

weaver.processes.utils.jsonify_output(output: owslib.wps.Output, process_description: owslib.wps.Process, container: Optional[AnySettingsContainer] = None) → JSON[source]

Utility method to jsonify an output element from a WPS1 process description.

In the case that a reference JSON output is specified and that it refers to a file that contains an array list of URL references to simulate a multiple-output, this specific output gets expanded to contain both the original URL reference field and the loaded URL list under data field for easier access from the response body.

weaver.processes.utils.convert_process_wps_to_db(service: Service, process: ProcessWPS, container: AnySettingsContainer) → ProcessDB[source]

Converts an owslib WPS Process to local storage Process.

weaver.processes.utils._check_deploy(payload)[source]

Validate minimum deploy payload field requirements with exception handling.

weaver.processes.utils._get_deploy_process_info(process_info, reference, package)[source]

Obtain the process definition from deploy payload with exception handling.

weaver.processes.utils.deploy_process_from_payload(payload: JSON, container: AnyContainer) → HTTPException[source]

Adds a weaver.datatype.Process instance to storage using the provided JSON payload matching weaver.wps_restapi.swagger_definitions.ProcessDescription.

Returns

HTTPOk if the process registration was successful

Raises

HTTPException – otherwise

weaver.processes.utils.register_wps_processes_from_config(wps_processes_file_path: Optional[FileSystemPathType], container: AnySettingsContainer)None[source]

Loads a wps_processes.yml file and registers WPS-1 providers processes to the current Weaver instance as equivalent WPS-2 processes.

See also

  • weaver.wps_processes.yml.example for additional file format details