kempnerpulse.reader.base¶
Layer 1 (Read) — backend contract and raw records.
This layer acquires raw data from one source and emits a stream of opaque
RawRecord objects keyed by the source’s own field names. By design, this
layer:
never coerces an
N/Areading to0.0(it usesNone);never looks up field meanings — naming, units, and missing-value policy are Layer 2’s responsibility;
never blocks on user input or installs signal handlers (that belongs to the cross-cutting tier).
Its runtime dependencies are the standard library only.
Classes
Layer 1 contract. |
|
What a backend can produce. |
|
Which Layer-1 source produced a record. |
|
One reading for one entity (a GPU or MIG slice), in the source's vocabulary. |
|
Minimal Layer-1 configuration. |
Exceptions
The |
|
|
|
|
|
Base for Layer-1 read failures. |
|
Could not acquire the requested DCGM watch fields without dropping another consumer. |
- class kempnerpulse.reader.base.BackendKind[source]¶
Bases:
EnumWhich Layer-1 source produced a record.
- DCGMI = 'dcgmi'¶
- PROMETHEUS = 'prometheus'¶
- REPLAY = 'replay'¶
- NVML_DIRECT = 'nvml_direct'¶
- class kempnerpulse.reader.base.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.base.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.base.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'¶
- class kempnerpulse.reader.base.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)¶
- exception kempnerpulse.reader.base.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.base.ExporterCollisionDetected[source]¶
Bases:
ReaderErrordcgm-exporteralready holds the profiling watch; recommend--backend prometheus.
- exception kempnerpulse.reader.base.ReservationDeniedError[source]¶
Bases:
ReaderErrorCould not acquire the requested DCGM watch fields without dropping another consumer.
- exception kempnerpulse.reader.base.DcgmStreamError[source]¶
Bases:
ReaderErrorThe
dcgmi dmonstreaming subprocess failed or exited unexpectedly.