CSP.LMC Observation Supervisor
- class ska_csp_lmc_common.observation.observation_supervisor.CspObservationSupervisor(*, model: SubarrayObsStateModel, policy: CspScanConsistencyPolicy, store: StateStore, update_attribute: Callable[[str, Any], None], get_obs_modes: Callable[[], list], logger: Logger, debounce_s: float = 0.1, max_latency: float = 0.3)
Bases:
ObservationSupervisorSupervisor implementation focusing on _evaluate_and_publish logic.
The base ObservationSupervisor still provides debounce/max-latency timing and a background tick thread.
Key behavior: - On evaluation, take a snapshot from the StateStore and ask the model to compute/store the aggregated candidate via evaluate_states(…). - Run the consistency policy on (candidate, obsModes, snapshot). - If a hard inconsistency is detected,latch FAULT via model component_fault (True) with cause=CONSISTENCY (cleared only by recovery logic). - Otherwise, apply the policy final state via model.apply_final_state(…). The ObsStateModel is the single authority responsible for de-duplication, precedence, and publication of obsState changes.
- on_subsystem_event(component: ObservingComponent, obs_state: ska_control_model.ObsState | None = None, **kwargs) None
Entry point for subsystem ObsState events from EventManager.
It handles the ingestion, debouncing, and orchestration of the state evaluation.
- Parameters:
component – The component that generated the event.
value – The new ObsState value.
kwargs – Additional arguments.
- on_model_update(obs_state: ska_control_model.ObsState) None
Handles state change notifications originating from the ObsStateModel itself (e.g., entering a transitional state like CONFIGURING).
These updates are considered high-priority and will always trigger an immediate evaluation, bypassing the debounce delay.
- clear_consistency_fault() None
Clear fault flags and reset consistency error messages.
- _evaluate_and_publish(*, force: bool = False) None
Evaluate the CSP subarray observation state.
This method takes a snapshot of subsystem states, evaluates aggregation and consistency policies, manages hard faults, and applies the resulting ObsState to the ObsStateModel.
The evaluation follows these steps:
1. Take an atomic snapshot of all subsystem ObsState values from the StateStore and update the subarray aggregation model via evaluate_states(…). The aggregated candidate state is stored in the model but not published.
2. Apply the CSP scan consistency policy to the aggregated candidate state, the active observation modes, and the full subsystem snapshot to detect hard inconsistencies or invalid combinations.
3. Manage FAULT transitions using a single fault mechanism (component_fault):
- If the policy reports a hard fault, the subarray is forced into
FAULT with cause CONSISTENCY. This state is latched until an explicit recovery action.
- If no hard fault is reported and the subarray is currently in
FAULT due to a consistency violation, the FAULT state is cleared automatically.
Fault-related diagnostic information (consistency flag and error message) is updated as part of this step.
4. Apply the final subarray ObsState to the ObsStateModel via apply_final_state(…). The model is responsible for precedence, de-duplication, and publication to the TANGO attribute if the value changes.
This method does not clear FAULT conditions caused by subsystem or internal errors; those require an explicit recovery action (e.g. Restart).