kafka_dae_diagnostics.config

Utilities for reading Diagnostics IOC configuration from TOML.

Members

DiagnosticsConfig

Create a new model by parsing and validating input data from keyword arguments.

load_config

Validate and load a config file at the specified path.

class kafka_dae_diagnostics.config.DiagnosticsConfig(*, pv_prefix: str, callback_frequency_ms: Annotated[float, Gt(gt=0)], runinfo_topic: str, events_topic: str, kafka_runinfo_consumer: dict[str, str], kafka_events_consumer: dict[str, str], veto_names: Annotated[list[str] | None, MinLen(min_length=32), MaxLen(max_length=32)] = None, min_vetoing_percentage: float = 50.0, stale_event_message_timeout_s: float = 5.0)[source]

Bases: BaseModel

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.

callback_frequency_ms: Annotated[float, Gt(gt=0)]

How often (milliseconds) to update EPICS PVs.

events_topic: str

Kafka topic on which to listen for event messages.

kafka_events_consumer: dict[str, str]

Kafka settings for event stream consumer.

kafka_runinfo_consumer: dict[str, str]

Kafka settings for runInfo stream consumer.

min_vetoing_percentage: float

The minimum active percentage (for each individual veto), beyond which the run state will be VETOING rather than RUNNING.

pv_prefix: str

PV prefix of all PVs on this IOC.

runinfo_topic: str

Kafka topic on which to listen for runInfo messages.

stale_event_message_timeout_s: float

When running, if we have not received messages on the _events stream within this many seconds from now, the run state will be PROCESSING rather than RUNNING.

veto_names: Annotated[list[str] | None, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=32), MaxLen(max_length=32)])]

Veto names, as a list of strings.

The first item in this list has bitmask (1 << 0), the last item has bitmask (1 << 31). There must be exactly 32 entries in this list.

kafka_dae_diagnostics.config.load_config(config_path: str) DiagnosticsConfig[source]

Validate and load a config file at the specified path.