labthings_fastapi.actions.invocation_model
Invocation Model.
This module contains types used to describe an Invocation.
Attributes
Classes
The current status of an |
|
A model to serialise |
|
A model to serialise |
Module Contents
- class labthings_fastapi.actions.invocation_model.InvocationStatus(*args, **kwds)
Bases:
enum.EnumThe current status of an
Invocation.- PENDING = 'pending'
The
Invocationhas not yet been started.
- RUNNING = 'running'
The
Invocationis running in its thread.
- COMPLETED = 'completed'
The
Invocationfinished successfully. A return value may be available.
- CANCELLED = 'cancelled'
The
Invocationwas cancelled and has finished.
- ERROR = 'error'
The
Invocationterminated unexpectedly due to an error.
- class labthings_fastapi.actions.invocation_model.LogRecordModel(/, **data: Any)
Bases:
pydantic.BaseModelA model to serialise
logging.LogRecordobjects.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.selfis explicitly positional-only to allowselfas a field name.- model_config
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- created: datetime.datetime
- classmethod generate_message(data: Any) Any
Ensure LogRecord objects have constructed their message.
- Parameters:
data – The LogRecord to process.
- Returns:
The LogRecord, with a message constructed.
- labthings_fastapi.actions.invocation_model.InputT
- labthings_fastapi.actions.invocation_model.OutputT
- class labthings_fastapi.actions.invocation_model.GenericInvocationModel(/, **data: Any)
Bases:
pydantic.BaseModel,Generic[InputT,OutputT]A model to serialise
Invocationobjects 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
Anybecause 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.selfis explicitly positional-only to allowselfas a field name.- status: InvocationStatus
- timeStarted: datetime.datetime | None
- timeRequested: datetime.datetime | None
- timeCompleted: datetime.datetime | None
- input: InputT
- output: OutputT
- log: Sequence[LogRecordModel]
- links: labthings_fastapi.thing_description._model.Links = None
- labthings_fastapi.actions.invocation_model.InvocationModel