mpylab.env.eut.session module¶
RF-neutral lifecycle management for EUT monitoring.
- class mpylab.env.eut.session.EUTMonitoringSession(monitor: EUTMonitor)
Bases:
objectManage monitors and classify their events for one EUT exposure.
The session deliberately has no access to RF hardware and does not apply retry or stop policies. Measurement kernels remain responsible for those safety and workflow decisions.
- Parameters:
monitor (EUTMonitor) – Monitor, commonly a
CompositeEUTMonitor, whose lifecycle is managed by the session.
- monitor
Managed monitor instance.
- Type:
- active
Whether an exposure is active.
- Type:
bool
- phase
Current exposure phase, or
Noneoutside an exposure.- Type:
str or None
- close() None
Stop an active exposure and release all monitor resources.
- property diagnostics: tuple[dict, ...]
Return monitor diagnostics collected during the current exposure.
- property events: tuple[dict, ...]
Return status events collected during the current exposure.
- classmethod from_monitors(manual_monitor: ManualEUTMonitor, automatic_monitors: EUTMonitor | Iterable[EUTMonitor] = ()) EUTMonitoringSession
Build a session with mandatory manual operator intervention.
- Parameters:
manual_monitor (ManualEUTMonitor) – Always-available manual observation and intervention source.
automatic_monitors (EUTMonitor or iterable of EUTMonitor, optional) – Additional automatic observation sources.
- Returns:
Session managing the combined monitor.
- Return type:
- poll_event(diagnostic_context: Mapping | None = None)
Return the next status event and retain diagnostics separately.
- Parameters:
diagnostic_context (mapping, optional) – Metadata added with
setdefaultto monitor diagnostics, for example the current frequency, position, or attempt number.- Returns:
Next validated status event. Diagnostics and an empty monitor queue both return
None; diagnostics are available throughdiagnosticsandpop_diagnostics().- Return type:
dict or None
- pop_diagnostics() list[dict]
Remove and return all diagnostics collected since the last call.
- Returns:
Collected monitor diagnostics in arrival order.
- Return type:
list of dict
- start_exposure(context: Mapping) None
Start a new exposure and clear records from the previous one.
- Parameters:
context (mapping) – Measurement-specific exposure context forwarded to every monitor.
- Raises:
RuntimeError – If another exposure is already active.
- start_phase(phase: str, context: Mapping) None
Switch all monitors to another phase of the active exposure.
- Parameters:
phase (str) – Exposure phase accepted by the EUT event schema.
context (mapping) – Measurement-specific phase context forwarded to every monitor.
- Raises:
RuntimeError – If no exposure is active.
- stop_exposure() None
Stop the active exposure; repeated calls are harmless.