timing.tracker ============== .. py:module:: timing.tracker Attributes ---------- .. autoapisummary:: timing.tracker.AnomalyCallback Classes ------- .. autoapisummary:: timing.tracker.StepTimingTracker Module Contents --------------- .. py:data:: AnomalyCallback .. py:class:: StepTimingTracker(config: Optional[timing.config.TimingConfig] = None) Bases: :py:obj:`raccoon.class_name_logger.ClassNameLogger` Singleton tracker that persists step runtimes and reports anomalies. .. py:attribute:: config .. py:attribute:: database .. py:attribute:: anomaly_callbacks :type: List[AnomalyCallback] :value: [] .. py:method:: get_instance() -> StepTimingTracker :classmethod: Return the process-wide tracker instance used by ``Step.run_step``. .. py:method:: configure(config: timing.config.TimingConfig) -> None Replace configuration at runtime. .. py:method:: register_anomaly_callback(callback: AnomalyCallback) -> None Register an async callback to run when an anomaly is detected. .. py:method:: record_execution(signature: str, duration: float) -> Optional[timing.models.AnomalyDetection] :async: Persist execution and evaluate for anomalies. :returns: The detected anomaly, or ``None`` if the execution was normal. .. py:method:: get_upper_bound(signature: str) -> Optional[float] :async: Return the anomaly upper bound for a signature, or ``None`` if no baseline. This is the duration above which an execution would be flagged as SLOWER than expected. Used by the live watchdog in ``Step.run_step``.