labthings_fastapi.invocations
Invocation Model.
This module contains types used to describe an Invocation.
Attributes
A model to serialise |
Classes
The current status of an |
|
A model to serialise |
|
A model to represent |
|
A model to serialise |
Module Contents
- class labthings_fastapi.invocations.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.invocations.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 or serialised log record data to process.
- Returns:
The LogRecord, with a message constructed.
- class labthings_fastapi.invocations.InvocationSummary(/, **data: Any)
Bases:
pydantic.BaseModelA model to represent
Invocationobjects over HTTP.This version of the model does not include logs our action outputs, and is intended for use in endpoints that might list several invocations.
See
GenericInvocationModelfor the full representation, to be used in endpoints referring to one specific invocation.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
- links: labthings_fastapi.thing_description._model.Links = None
- labthings_fastapi.invocations.InputT
- labthings_fastapi.invocations.OutputT
- class labthings_fastapi.invocations.GenericInvocationModel(/, **data: Any)
Bases:
InvocationSummary,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.- input: InputT
- output: OutputT
- log: Sequence[LogRecordModel]
- labthings_fastapi.invocations.InvocationModel
A model to serialise
Invocationobjects when they are polled over HTTP.