kempnerpulse.translate.mapping
Source-vocabulary → canonical-vocabulary mapping and unit normalization.
The mapping table is keyed by the source field name (DCGM field identifiers,
which both the dcgmi backend and dcgm-exporter use) and gives the
canonical CanonicalRecord field plus a unit kind. Unit kinds are applied by
convert to bring source units into canonical units (fractions in [0,1],
bytes/second, joules, …). A None reading stays None — never coerced.
Functions
convert(unit_kind, value)
|
Apply unit_kind to one source value, returning the canonical value. |
map_field(source_name)
|
Return (canonical_name, unit_kind) for a source field, or None. |
-
kempnerpulse.translate.mapping.convert(unit_kind, value)[source]
Apply unit_kind to one source value, returning the canonical value.
None passes through as None (the source did not provide a reading).
- Parameters:
unit_kind (str)
-
kempnerpulse.translate.mapping.map_field(source_name)[source]
Return (canonical_name, unit_kind) for a source field, or None.
- Parameters:
source_name (str)
- Return type:
Tuple[str, str] | None