kempnerpulse.present.csv_writer

CSV export — the column registry keyed to ComputedRecord/canonical.

The export schema (column names, units, precision, and ordering) is preserved exactly from the single-file implementation so downstream tooling reads the same files. The difference is the source: each column extracts from a ComputedRecord and its CanonicalRecord (canonical fractions/SI) and converts to the documented display unit at write time.

Audit of units/precision (unchanged from legacy):

  • *_pct columns: fraction × 100 formatted .2f;

  • pcie_*_bytes_s: raw bytes/second formatted .4f;

  • nvlink_gbps: bytes/s ÷ 1e9 formatted .4f (== legacy MB/s ÷ 1e3);

  • power_w / *_temp_c / *_clock_mhz / mem_used_mib: raw value .4f;

  • mem_total_mib: .1f; mem_used_pct: .2f;

  • energy_j: cumulative joules .1f;

  • pcie_replay_rate_s: differenced rate .2f;

  • real_util_pct: .2f; status / health: strings from the record.

An unavailable reading (None) is emitted as an empty field, never 0.

Functions

csv_header(columns)

The header row (column names) for a resolved column list.

csv_row(record, timestamp, columns)

One CSV row for record at timestamp over the resolved columns.

resolve_columns(spec)

Resolve an export spec to an ordered list of (name, extractor).

Exceptions

UnknownExportColumns

One or more requested export columns are not in the registry.

exception kempnerpulse.present.csv_writer.UnknownExportColumns[source]

Bases: ValueError

One or more requested export columns are not in the registry.

__init__(bad)[source]
Parameters:

bad (Sequence[str])

kempnerpulse.present.csv_writer.resolve_columns(spec)[source]

Resolve an export spec to an ordered list of (name, extractor).

spec is "default", "all", or a comma-separated list of column names. Unknown names raise UnknownExportColumns (the caller decides how to surface it — this layer does not exit the process).

Parameters:

spec (str)

Return type:

List[Tuple[str, Callable[[ComputedRecord, float], str]]]

kempnerpulse.present.csv_writer.csv_header(columns)[source]

The header row (column names) for a resolved column list.

Parameters:

columns (Sequence[Tuple[str, Callable[[ComputedRecord, float], str]]])

Return type:

List[str]

kempnerpulse.present.csv_writer.csv_row(record, timestamp, columns)[source]

One CSV row for record at timestamp over the resolved columns.

Parameters:
Return type:

List[str]