labthings_fastapi.invocations ============================= .. py:module:: labthings_fastapi.invocations .. autoapi-nested-parse:: Invocation Model. This module contains types used to describe an `.Invocation`. Attributes ---------- .. autoapisummary:: labthings_fastapi.invocations.InputT labthings_fastapi.invocations.OutputT labthings_fastapi.invocations.InvocationModel Classes ------- .. autoapisummary:: labthings_fastapi.invocations.InvocationStatus labthings_fastapi.invocations.LogRecordModel labthings_fastapi.invocations.GenericInvocationModel Module Contents --------------- .. py:class:: InvocationStatus(*args, **kwds) Bases: :py:obj:`enum.Enum` The current status of an `.Invocation`. .. py:attribute:: PENDING :value: 'pending' The `.Invocation` has not yet been started. .. py:attribute:: RUNNING :value: 'running' The `.Invocation` is running in its thread. .. py:attribute:: COMPLETED :value: 'completed' The `.Invocation` finished successfully. A return value may be available. .. py:attribute:: CANCELLED :value: 'cancelled' The `.Invocation` was cancelled and has finished. .. py:attribute:: ERROR :value: 'error' The `.Invocation` terminated unexpectedly due to an error. .. py:class:: LogRecordModel(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` A model to serialise `logging.LogRecord` objects. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: message :type: str .. py:attribute:: levelname :type: str .. py:attribute:: levelno :type: int .. py:attribute:: lineno :type: int .. py:attribute:: filename :type: str .. py:attribute:: created :type: datetime.datetime .. py:method:: generate_message(data: Any) -> Any :classmethod: Ensure LogRecord objects have constructed their message. :param data: The LogRecord to process. :return: The LogRecord, with a message constructed. .. py:data:: InputT .. py:data:: OutputT .. py:class:: GenericInvocationModel(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`Generic`\ [\ :py:obj:`InputT`\ , :py:obj:`OutputT`\ ] A model to serialise `.Invocation` objects when they are polled over HTTP. The input and output models are generic parameters, to allow this model to be used for specific Actions. These are usually set to `Any` because the invocation endpoint is not specific to any one Action, and thus the types are not known in advance. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: status :type: InvocationStatus .. py:attribute:: id :type: uuid.UUID .. py:attribute:: href :type: str .. py:attribute:: timeStarted :type: Optional[datetime.datetime] .. py:attribute:: timeRequested :type: Optional[datetime.datetime] .. py:attribute:: timeCompleted :type: Optional[datetime.datetime] .. py:attribute:: input :type: InputT .. py:attribute:: output :type: OutputT .. py:attribute:: log :type: Sequence[LogRecordModel] .. py:attribute:: links :type: labthings_fastapi.thing_description._model.Links :value: None .. py:data:: InvocationModel A model to serialise `.Invocation` objects when they are polled over HTTP.