:mod:`weaver.datatype` ====================== .. py:module:: weaver.datatype .. autoapi-nested-parse:: Definitions of types used by tokens. Module Contents --------------- .. data:: LOGGER .. py:class:: Base Bases: :class:`dict` Dictionary with extended attributes auto-``getter``/``setter`` for convenience. Explicitly overridden ``getter``/``setter`` attributes are called instead of ``dict``-key ``get``/``set``-item to ensure corresponding checks and/or value adjustments are executed before applying it to the sub-``dict``. .. attribute:: id .. method:: json(self) 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. .. method:: params(self) 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. .. py:class:: Service(*args, **kwargs) Bases: :class:`weaver.datatype.Base` Dictionary that contains OWS services. It always has ``url`` key. .. attribute:: id .. attribute:: url Service URL. .. attribute:: name Service name. .. attribute:: type Service type. .. attribute:: public Flag if service has public access. .. attribute:: auth public, token, cert. :type: Authentication method .. method:: json(self) .. method:: params(self) .. py:class:: Job(*args, **kwargs) Bases: :class:`weaver.datatype.Base` Dictionary that contains OWS service jobs. It always has ``id`` and ``task_id`` keys. .. attribute:: id .. attribute:: task_id .. attribute:: service .. attribute:: process .. attribute:: inputs .. attribute:: user_id .. attribute:: status .. attribute:: status_message .. attribute:: status_location .. attribute:: notification_email .. attribute:: accept_language .. attribute:: execute_async .. attribute:: is_workflow .. attribute:: created .. attribute:: finished .. attribute:: duration .. attribute:: duration_str .. attribute:: progress .. attribute:: results .. attribute:: exceptions .. attribute:: logs .. attribute:: tags .. attribute:: access Job visibility access from execution. .. attribute:: request XML request for WPS execution submission as string. .. attribute:: response XML status response from WPS execution submission as string. .. method:: _get_log_msg(self, msg=None) .. method:: save_log(self, errors=None, logger=None, message=None, level=INFO) Logs the specified error and/or message, and adds the log entry to the complete job log. For each new log entry, additional :class:`Job` properties are added according to :meth:`Job._get_log_msg` and the format defined by :func:`get_job_log_msg`. :param errors: An error message or a list of WPS exceptions from which to log and save generated message stack. :param logger: An additional :class:`Logger` for which to propagate logged messages on top saving them to the job. :param message: Explicit string to be logged, otherwise use the current :py:attr:`Job.status_message` is used. :param level: Logging level to apply to the logged ``message``. This parameter is ignored if ``errors`` are logged. .. note:: The job object is updated with the log but still requires to be pushed to database to actually persist it. .. method:: _get_inputs(self) .. method:: _set_inputs(self, inputs) .. method:: is_finished(self) .. method:: mark_finished(self) .. method:: _get_results(self) .. method:: _set_results(self, results) .. method:: _get_exceptions(self) .. method:: _set_exceptions(self, exceptions) .. method:: _get_logs(self) .. method:: _set_logs(self, logs) .. method:: _get_tags(self) .. method:: _set_tags(self, tags) .. method:: _job_url(self, settings) .. method:: json(self, container=None) Obtain 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. .. method:: params(self) .. py:class:: Process(*args, **kwargs) Bases: :class:`weaver.datatype.Base` Dictionary that contains a process description for db storage. It always has ``identifier`` and ``processEndpointWPS1`` keys. .. attribute:: id .. attribute:: identifier .. attribute:: title .. attribute:: abstract .. attribute:: keywords .. attribute:: metadata .. attribute:: version .. attribute:: inputs .. attribute:: outputs .. attribute:: jobControlOptions .. attribute:: outputTransmission .. attribute:: processDescriptionURL .. attribute:: processEndpointWPS1 .. attribute:: executeEndpoint .. attribute:: owsContext .. attribute:: type .. attribute:: package Package CWL definition as JSON. .. attribute:: payload Deployment specification as JSON body. .. attribute:: _character_codes :annotation: = [['$', '$'], ['.', '.']] .. attribute:: visibility .. attribute:: params_wps Values applicable to PyWPS Process ``__init__`` .. staticmethod:: _recursive_replace(pkg, index_from, index_to) .. staticmethod:: _encode(obj) .. staticmethod:: _decode(obj) .. method:: params(self) .. method:: json(self) .. method:: process_offering(self) .. method:: process_summary(self) .. staticmethod:: from_wps(wps_process, **extra_params) Converts a PyWPS Process into a :class:`weaver.datatype.Process` using provided parameters. .. method:: wps(self) .. py:class:: Quote(*args, **kwargs) Bases: :class:`weaver.datatype.Base` Dictionary that contains quote information. It always has ``id`` and ``process`` keys. .. attribute:: id Quote ID. .. attribute:: title Quote title. .. attribute:: description Quote description. .. attribute:: details Quote details. .. attribute:: user User ID requesting the quote .. attribute:: process WPS Process ID. .. attribute:: estimatedTime Process estimated time. .. attribute:: processParameters Process execution parameters for quote. .. attribute:: location WPS Process URL. .. attribute:: price Price of the current quote .. attribute:: currency Currency of the quote price .. attribute:: expire Quote expiration datetime. .. attribute:: created Quote creation datetime. .. attribute:: steps Sub-quote IDs if applicable .. method:: params(self) .. method:: json(self) .. py:class:: Bill(*args, **kwargs) Bases: :class:`weaver.datatype.Base` Dictionary that contains bill information. It always has ``id``, ``user``, ``quote`` and ``job`` keys. .. attribute:: id Bill ID. .. attribute:: user User ID .. attribute:: quote Quote ID. .. attribute:: job Job ID. .. attribute:: price Price of the current quote .. attribute:: currency Currency of the quote price .. attribute:: created Quote creation datetime. .. attribute:: title Quote title. .. attribute:: description Quote description. .. method:: params(self) .. method:: json(self)