OpenFactory Supervisor Schemas#

OpenFactory Supervisor Schemas

This module defines Pydantic models for configuring OpenFactory supervisors and their associated adapters. It provides structured schemas with validation logic to ensure correct and consistent configuration of supervisor components within OpenFactory devices.

Validation Features:#

  • Strict enforcement of mutually exclusive ‘ip’ and ‘image’ fields in adapter configurations.

  • Support for specifying deployment options including resource limits and placement constraints.

  • Clear separation of supervisor container settings and adapter-specific parameters.

class openfactory.schemas.supervisors.Supervisor(**data)[source]#

Bases: BaseModel

OpenFactory Supervisor Schema.

Defines the supervisor container including image, adapter configuration, and optional deployment parameters.

adapter: SupervisorAdapter#
deploy: Deploy | None#
image: str#
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class openfactory.schemas.supervisors.SupervisorAdapter(**data)[source]#

Bases: BaseModel

Supervisor Adapter Schema.

Represents the adapter configuration used by the OpenFactory supervisor. Exactly one of ip or image must be provided (mutually exclusive).

deploy: Deploy | None#
environment: List[str] | None#
image: str | None#
ip: str | None#
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

port: int#
classmethod validate_adapter(values)[source]#

Validates that either ‘ip’ or ‘image’ is specified, but not both.

Return type:

Dict

Parameters:

values (Dict) – Values to validate.

Returns:

Dict – Validated values.

Raises:

ValueError – If both or neither of ‘ip’ and ‘image’ are specified.