weaver.processes.utils
¶
Module Contents¶
-
weaver.processes.utils.
get_process
(process_id: Optional[str] = None, request: Optional[pyramid.request.Request] = None, settings: Optional[weaver.typedefs.SettingsType] = None, store: Optional[weaver.store.base.StoreProcesses] = None) → weaver.datatype.Process[source]¶ Obtain the specified process and validate information, returning appropriate HTTP error if invalid.
Process identifier must be provided from either the request path definition or literal ID. Database must be retrievable from either the request, underlying settings, or direct store reference.
Different parameter combinations are intended to be used as needed or more appropriate, such that redundant operations can be reduced where some objects are already fetched from previous operations.
-
weaver.processes.utils.
get_job_submission_response
(body: weaver.typedefs.JSON) → pyramid.httpexceptions.HTTPCreated[source]¶ Generates the successful response from contents returned by job submission process.
-
weaver.processes.utils.
map_progress
(progress: weaver.typedefs.Number, range_min: weaver.typedefs.Number, range_max: weaver.typedefs.Number) → weaver.typedefs.Number[source]¶ Calculates the relative progression of the percentage process within min/max values.
-
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: weaver.typedefs.JSON, container: weaver.typedefs.AnyContainer, overwrite: bool = False) → pyramid.httpexceptions.HTTPException[source]¶ Adds a
weaver.datatype.Process
instance to storage using the provided JSONpayload
matchingweaver.wps_restapi.swagger_definitions.ProcessDescription
.- Parameters
payload – JSON payload that was specified during the process deployment request.
container – container to retrieve application settings.
overwrite – whether to allow override of an existing process definition if conflict occurs.
- Returns
HTTPOk if the process registration was successful.
- Raises
HTTPException – for any invalid process deployment step.
-
weaver.processes.utils.
parse_wps_process_config
(config_entry: Union[weaver.typedefs.JSON, str]) → Tuple[str, str, List[str], bool][source]¶ Parses the available WPS provider or process entry to retrieve its relevant information.
- Returns
WPS provider name, WPS service URL, and list of process identifier(s).
- Raises
ValueError – if the entry cannot be parsed correctly.
-
weaver.processes.utils.
register_wps_processes_from_config
(wps_processes_file_path: Optional[weaver.typedefs.FileSystemPathType], container: weaver.typedefs.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.
References listed under
processes
are registered. When the reference is a service (provider), registration of each WPS process is done individually for each of the specified providers with ID[service]_[process]
per listed process byGetCapabilities
.New in version 1.14.0: When references are specified using
providers
section instead ofprocesses
, the registration only saves the remote WPS provider endpoint to dynamically populate WPS processes on demand.See also
weaver.wps_processes.yml.example for additional file format details