Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-27 07:41:44

0001 """Shared helpers for alarm modules.
0002 
0003 Nothing here is a registry or dispatch table — alarm modules import what
0004 they need and no more. `Detection` is the value-type alarm modules yield;
0005 subfiles (e.g. ``failure_rate.py``) are reusable PanDA-query helpers.
0006 
0007 Snowflake rule (from the project dialog): each alarm is its own module
0008 under ``swf_alarms/alarms/<name>.py`` that exposes ``check(client, params)``.
0009 If two alarms share code, they share it by importing the same helper —
0010 not by being entries in a central registry.
0011 """
0012 from __future__ import annotations
0013 
0014 from dataclasses import dataclass, field
0015 
0016 
0017 @dataclass
0018 class Detection:
0019     dedupe_key: str              # per-entity identifier, e.g. "task:35981"
0020     subject: str                 # short line for email subject + dashboard
0021     body_context: str            # detail text (appended to alarm config body)
0022     extra_data: dict = field(default_factory=dict)  # structured context