kempnerpulse.reader¶
KempnerPulse Layer 1 — Read.
Backends acquire raw data from a single source and emit a stream of opaque
RawRecord objects in that source’s own vocabulary. Interpreting those records
(canonical names, units, missing-value policy) belongs to Layer 2, not here.
make_backend selects a backend from a ReaderConfig.
Functions
|
Construct the backend named by |
- class kempnerpulse.reader.Backend[source]¶
Bases:
ProtocolLayer 1 contract. Implementations: dcgmi, prometheus, replay.
- open(config)[source]¶
Acquire the source (spawn dcgmi, open the HTTP scrape, open the replay file).
Backends that contend for a shared resource (dcgmi profiling watch) run their preflight here and raise a typed
ReaderErrorwith remediation on failure.- Parameters:
config (ReaderConfig)
- Return type:
None
- property caps: BackendCaps¶
Static capabilities (kind + producible source fields).
- __init__(*args, **kwargs)¶
- class kempnerpulse.reader.BackendCaps[source]¶
Bases:
objectWhat a backend can produce.
fieldsis the set of source field names this backend can emit. Layer 2 uses it to decide which canonical metrics are available for a given source.- kind: BackendKind¶
- __init__(kind, fields=<factory>)¶
- Parameters:
kind (BackendKind)
- Return type:
None
- class kempnerpulse.reader.BackendKind[source]¶
Bases:
EnumWhich Layer-1 source produced a record.
- DCGMI = 'dcgmi'¶
- PROMETHEUS = 'prometheus'¶
- REPLAY = 'replay'¶
- NVML_DIRECT = 'nvml_direct'¶
- class kempnerpulse.reader.RawRecord[source]¶
Bases:
objectOne reading for one entity (a GPU or MIG slice), in the source’s vocabulary.
fieldscarries the source’s raw key/values for this entity — metric values (typicallyfloat) and any source labels (str). A value isNonewhen the source reportedN/A; it is never silently coerced to0. Assigning meaning to these keys (canonical names, units, identity) is Layer 2’s job.
- class kempnerpulse.reader.ReaderConfig[source]¶
Bases:
objectMinimal Layer-1 configuration.
A deliberately small, self-contained slice of configuration so that Layer 1 can be constructed and tested on its own. The cross-cutting configuration tier supplies these values from parsed CLI arguments.
- backend: BackendKind = 'dcgmi'¶
- exception kempnerpulse.reader.ReaderError[source]¶
Bases:
RuntimeErrorBase for Layer-1 read failures. Carries an actionable remediation string.
Bases:
ReaderErrornv-hostengineis not reachable on the local socket.
- exception kempnerpulse.reader.ExporterCollisionDetected[source]¶
Bases:
ReaderErrordcgm-exporteralready holds the profiling watch; recommend--backend prometheus.
- exception kempnerpulse.reader.ReservationDeniedError[source]¶
Bases:
ReaderErrorCould not acquire the requested DCGM watch fields without dropping another consumer.
- exception kempnerpulse.reader.DcgmStreamError[source]¶
Bases:
ReaderErrorThe
dcgmi dmonstreaming subprocess failed or exited unexpectedly.
- kempnerpulse.reader.make_backend(config)[source]¶
Construct the backend named by
config.backend(imported lazily).- Parameters:
config (ReaderConfig)
- Return type:
Modules
Layer 1 (Read) — backend contract and raw records. |
|
Layer 1 (Read) — direct DCGM backend ( |
|
Layer 1 (Read) — preflight checks for the direct DCGM backend. |
|
Layer 1 (Read) — Prometheus backend ( |
|
Layer 1 (Read) — replay backend. |