saturnin.base.component

Saturnin abstract base class for Components.

Saturnin components are microservices, services or other software components that could be executed on Saturnin platform, typically under supervision of Controller(s).

Classes

class saturnin.base.component.ComponentConfig(name: str)[source]

Bases: Config

Base Component configuration.

Parameters:

name (str) – Component name (used as conf. file section name for component).

agent: UUIDOption

Agent identification

logging_id: StrOption

Logging ID for this component instance

class saturnin.base.component.Component[source]

Bases: ABC

Abstract base class for Saturnin Components, which represent executable units like microservices or services managed by the platform.

abstractmethod initialize(config: ComponentConfig) None[source]

Verify configuration and assemble component structural parts.

Parameters:

config (ComponentConfig) – Component configuration.

Return type:

None

abstractmethod run() None[source]

Component execution (main loop).

Return type:

None

abstractmethod warm_up(ctrl_addr: ZMQAddress | None) None[source]

Initializes essential communication infrastructure for the component.

Implementations must initialize their ChannelManager and establish a connection to the control channel at the provided ctrl_addr. This connection is typically used for Inter-Component Communication Protocol (ICCP) with a controller.

Parameters:

ctrl_addr (ZMQAddress | None) – The ZMQ address of the controller’s control channel. If None, the component might operate in a standalone mode or a specific behavior should be defined by the implementer.

Return type:

None

Functions

saturnin.base.component.create_config(_cls: type[ComponentConfig], agent: UUID, name: str) ComponentConfig[source]

Returns a newly created ComponentConfig instance (or a subclass instance).

This function is primarily intended to be used with functools.partial when defining the config factory in ServiceDescriptor instances.

Parameters:
  • _cls (type[ComponentConfig]) – The ComponentConfig class (or a subclass of it) to instantiate.

  • agent (UUID) – The UUID for component identification, to be set in the config.

  • name (str) – The name to be used by the configuration class (often for section naming).

Returns:

An initialized instance of the provided _cls.

Return type:

ComponentConfig