orangeqs.juice.schemas.parameter_monitor#

Data Structures for Throttling.

Module Contents#

Classes#

ParameterMonitorConfig

Parameter Monitor configuration.

JuiceTopicMonitorConfig

Base monitoring configuration for individual units.

ThrottleState

Throttle state of a monitoring unit.

ThrottleStateEvent

Throttle state event for pubsub and database update.

API#

class orangeqs.juice.schemas.parameter_monitor.ParameterMonitorConfig(/, **data: Any)#

Bases: orangeqs.juice.settings.Configurable

Parameter Monitor configuration.

This configuration defines the juice parameters to monitor for throttling and their thresholds.

filename: ClassVar[str]#

‘parameter-monitor’

Filename for configuration.

juice_topic_monitoring_units: dict[str, JuiceTopicMonitorConfig]#

‘Field(…)’

Dictionary of Juice Topic Monitor units.

The key is the unique identifier for the unit, and the value is the configuration for that unit.

class orangeqs.juice.schemas.parameter_monitor.JuiceTopicMonitorConfig(/, **data: Any)#

Bases: orangeqs.juice.settings.BaseConfigurable

Base monitoring configuration for individual units.

Defines a topic and field to monitor, and thresholds for warning and throttling.

display_label: str#

None

Human-readable description to display in the UI.

unit: str#

‘1’

Unit that the value is measured in. Must be compatible with pint.Unit().

Defaults to dimensionless unit.

monitored_topic: str#

None

Juice topic to subscribe for monitoring the unit.

monitored_event_type: str#

None

Type of the event to monitor.

This should be the full module path of the event class, e.g. orangeqs.juice.system_monitor.data_structures.TemperaturePoint.

The field specified in monitored_field should be present in the data of this event.

monitored_field: str#

None

Field in the topic data to monitor.

warn_if_larger: float | None#

None

Warn users if the unit is above a certain value.

throttle_if_larger: float | None#

None

Pause executing experiments if the unit is above a certain value.

throttle_grace_interval: float#

0.0

Interval between detection of throttled state and actually throttling.

This value can be used if the value can fluctuate. If it is set to non-zero time, system will monitor value for that time to ensure that system should be throttled.

stop_throttle_if_smaller: float | None#

None

Resume executing experiments if the unit is below a certain value.

In general, this value should be less than throttle_if_larger. For example, if we are running equipment that is constantly heating up under the load and throttle at 90°C, it may be wise to wait until it cools down to 80°C before resuming experiments.

If throttle_if_larger is specified, stop_throttle_if_smaller will be set to the same value by default. If stop_throttle_if_smaller is larger than throttle_if_larger, settings won’t pass validation.

stop_throttle_grace_interval: float#

0.0

Interval between detection of safe state and actually resuming.

This value can be used if the value can fluctuate. If it is set to non-zero time, system will monitor value for that time to ensure that system should be resumed.

class orangeqs.juice.schemas.parameter_monitor.ThrottleState(*args, **kwds)#

Bases: enum.Flag

Throttle state of a monitoring unit.

Attributes#

  • THROTTLED (ThrottleState): The unit is throttled.

  • WARNING (ThrottleState): The unit is not throttled, but passed the warning threshold.

  • SAFE (ThrottleState): The unit is not throttled.

SAFE#

0

WARNING#

1

THROTTLED#

2

class orangeqs.juice.schemas.parameter_monitor.ThrottleStateEvent(/, **data: Any)#

Bases: orangeqs.juice.messaging.Event

Throttle state event for pubsub and database update.

For the global system throttle state, id should be set to “SYSTEM” and value set to None.

measurement: ClassVar[str]#

‘throttle_state’

Measurement name for throttle state.

topic() str#

Return the topic for the throttle state event.

throttled: orangeqs.juice.schemas.parameter_monitor.ThrottleState#

None

Whether the unit is currently throttled.

value: Any#

None

The value of the monitored parameter.

Marked as None for the global system throttle state.

id: Annotated[str, tag]#

None

ID for the unit that this event is associated with.

Marked as SYSTEM for the global system throttle state.

serialize_throttle_state(value: orangeqs.juice.schemas.parameter_monitor.ThrottleState) int#

Serialize the ThrottleState to an integer for storage in InfluxDB.