weaver.datatype¶
Module Contents¶
-
class
weaver.datatype.Base[source]¶ Dictionary with extended attributes auto-
getter/setterfor convenience. Explicitly overriddengetter/setterattributes are called instead ofdict-keyget/set-item to ensure corresponding checks and/or value adjustments are executed before applying it to the sub-dict.Initialize self. See help(type(self)) for accurate signature.
-
abstract
json(self) → weaver.typedefs.JSON[source]¶ Obtain the JSON data representation for response body.
Note
This method implementation should validate the JSON schema against the API definition whenever applicable to ensure integrity between the represented data type and the expected API response.
-
abstract
-
class
weaver.datatype.Service(*args, **kwargs)[source]¶ Dictionary that contains OWS services. It always has
urlkey.Initialize self. See help(type(self)) for accurate signature.
-
json(self) → weaver.typedefs.JSON[source]¶ Obtain the JSON data representation for response body.
Note
This method implementation should validate the JSON schema against the API definition whenever applicable to ensure integrity between the represented data type and the expected API response.
-
-
class
weaver.datatype.Job(*args, **kwargs)[source]¶ Dictionary that contains OWS service jobs. It always has
idandtask_idkeys.Initialize self. See help(type(self)) for accurate signature.
-
_get_log_msg(self: Optional[str], msg: Optional[str] = None, status: Optional[Number] = None, progress=None) → str[source]¶
-
save_log(self, errors: Optional[Union[str, Exception, WPSException, List[WPSException]]] = None, logger: Optional[Logger] = None, message: Optional[str] = None, level: int = INFO, status: Optional[str] = None, progress: Optional[Number] = None) → None[source]¶ Logs the specified error and/or message, and adds the log entry to the complete job log.
For each new log entry, additional
Jobproperties are added according toJob._get_log_msg()and the format defined byget_job_log_msg().- Parameters
errors – An error message or a list of WPS exceptions from which to log and save generated message stack.
logger – An additional
Loggerfor which to propagate logged messages on top saving them to the job.message – Explicit string to be logged, otherwise use the current
Job.status_messageis used.level – Logging level to apply to the logged
message. This parameter is ignored iferrorsare logged.status – Override status applied in the logged message entry, but does not set it to the job object. Uses the current :prop:`Job.status` value if not specified. Must be one of
Weaver.statusvalues.progress – Override progress applied in the logged message entry, but does not set it to the job object. Uses the current :prop:`Job.progress` value if not specified.
Note
The job object is updated with the log but still requires to be pushed to database to actually persist it.
-
property
task_id(self) → Optional[str][source]¶ Reference Task UUID attributed by the
Celeryworker that monitors and executes this job.
-
property
wps_id(self) → Optional[str][source]¶ Reference WPS Request/Response UUID attributed by the executed
PyWPSprocess.This UUID matches the status-location, log and output directory of the WPS process. This parameter is only available when the process is executed on this local instance.
See also
-
property
service(self) → Optional[str][source]¶ Service identifier of the corresponding remote process.
See also
-
property
process(self) → Optional[str][source]¶ Process identifier of the corresponding remote process.
See also
-
property
created(self) → datetime.datetime[source]¶
-
property
request(self) → Optional[str][source]¶ XML request for WPS execution submission as string (binary).
-
property
response(self) → Optional[str][source]¶ XML status response from WPS execution submission as string (binary).
-
links(self: Optional[AnySettingsContainer], container: Optional[str] = None, self_link=None) → weaver.typedefs.JSON[source]¶ Obtains the JSON links section of many response body for jobs.
If
self_linkis provided (e.g.: “outputs”) the link for that corresponding item will also be added as self entry to the links. It must be a recognized job link field.- Parameters
container – object that helps retrieve instance details, namely the host URL.
self_link – name of a section that represents the current link that will be returned.
-
json(self: Optional[AnySettingsContainer], container: Optional[str] = None, self_link=None) → weaver.typedefs.JSON[source]¶ Obtains the JSON data representation for response body.
Note
Settings are required to update API shortcut URLs to job additional information. Without them, paths will not include the API host, which will not resolve to full URI.
-
-
class
weaver.datatype.Process(*args, **kwargs)[source]¶ Dictionary that contains a process description for db storage. It always has
identifierandprocessEndpointWPS1keys.Initialize self. See help(type(self)) for accurate signature.
-
property
type(self) → str[source]¶ Type of process amongst
weaver.processes.typesdefinitions.
-
static
_recursive_replace(pkg: weaver.typedefs.JSON, index_from: int, index_to: int) → weaver.typedefs.JSON[source]¶
-
params(self) → Dict[str, Any][source]¶ Obtain the internal data representation for storage.
Note
This method implementation should provide a JSON-serializable definition of all fields representing the object to store.
-
json(self) → weaver.typedefs.JSON[source]¶ Obtains the JSON serializable complete representation of the process.
-
offering(self) → weaver.typedefs.JSON[source]¶ Obtains the JSON serializable offering representation of the process.
-
summary(self) → weaver.typedefs.JSON[source]¶ Obtains the JSON serializable summary representation of the process.
-
static
from_wps(wps_process: pywps.Process, **extra_params: Any) → weaver.datatype.Process[source]¶ Converts a
pywpsProcess into aweaver.datatype.Processusing provided parameters.
-
static
from_ows(process: owslib.wps.Process, service: weaver.datatype.Service, container: weaver.typedefs.AnySettingsContainer, **kwargs: Any) → weaver.datatype.Process[source]¶ Converts a
owslib.wpsProcess to local storageweaver.datatype.Process.
-
static
convert(process: weaver.typedefs.AnyProcess, service: Optional[Service] = None, container: Optional[AnySettingsContainer] = None, **kwargs: Any) → weaver.datatype.Process[source]¶ Converts known process equivalents definitions into the formal datatype employed by Weaver.
-
property
-
class
weaver.datatype.Quote(*args, **kwargs)[source]¶ Dictionary that contains quote information. It always has
idandprocesskeys.Initialize self. See help(type(self)) for accurate signature.
-
class
weaver.datatype.Bill(*args, **kwargs)[source]¶ Dictionary that contains bill information. It always has
id,user,quoteandjobkeys.Initialize self. See help(type(self)) for accurate signature.