kempnerpulse.present¶
KempnerPulse Layer 4 — Present.
The terminal UI and CSV export. This layer consumes ComputedRecord objects
(canonical metric values plus the derived Real Utilization / classification /
health signals) and renders them — it converts canonical fractions/SI to display
units (percent, GB/s, …) itself and never reaches back into source vocabulary.
Public API¶
Rendering / interaction:
render_dashboard(records, history, *, console_width, console_height, controller, summary_context) -> Layout— assemble one dashboard frame.SummaryContext— the per-frame context (system stats, source/poll labels, weight preset, hardware limits, job listing) the dashboard needs beyond the records. The lifecycle layer builds this.CommandController/cbreak_stdin(enabled)— keyboard command state and the raw-terminal context manager.HistoryStore/update_history(history, records)— the rolling per-GPU display-unit time-series store and its record→series adapter.GpuProcess— a Job-View process row (built by the lifecycle layer).
CSV export:
resolve_columns(spec) -> [(name, extractor), ...]— resolve"default"/"all"/ a comma-list to an ordered column set.csv_header(columns) -> [str]andcsv_row(record, timestamp, columns) -> [str]— emit the header and one row, with units/precision matching the documented export schema.UnknownExportColumns— raised byresolve_columnson a bad spec.
- kempnerpulse.present.render_dashboard(records, history, *, console_width, console_height, controller, summary_context)[source]¶
Assemble the full dashboard Layout for one frame.
Returns a Rich renderable (a
Layout). Below the per-card minimum size it returns a ‘widen me’ gate instead of squeezed cards. View selection followscontroller(plot / job / focus / fleet).- Parameters:
records (List[ComputedRecord])
history (HistoryStore)
console_width (int)
console_height (int)
controller (CommandController)
summary_context (SummaryContext)
- Return type:
Layout
- class kempnerpulse.present.SummaryContext[source]¶
Bases:
objectEverything the summary bar, footer, and view panels need besides the per-frame records/history/controller/dimensions.
The lifecycle layer builds one of these each frame (or reuses a mostly-static one and refreshes the volatile system fields). All fields have sensible defaults so a minimal caller can pass
SummaryContext().- gpu_processes: Dict[str, List[GpuProcess]]¶
- __init__(source='', poll=1.0, selection_desc='all', weights=(0.35, 0.35, 0.2, 0.1), app_version='', cpu_info=(None, None, None, None), ram_info=(None, None), power_limits=<factory>, nvlink_bw_limits=<factory>, pcie_bw_limits=<factory>, pcie_info='', gpu_processes=<factory>)¶
- class kempnerpulse.present.CommandController[source]¶
Bases:
objectView-mode and input state shared between the input loop and the renderer.
- kempnerpulse.present.cbreak_stdin(enabled)[source]¶
Put stdin into cbreak mode for single-keystroke input; no-op off-TTY.
- Parameters:
enabled (bool)
- class kempnerpulse.present.HistoryStore[source]¶
Bases:
objectFixed-capacity per-(gpu, key) ring buffers of floats.
- kempnerpulse.present.update_history(history, records)[source]¶
Push one batch of records’ display-unit series into
history.All conversions to display units happen here: percents come from canonical fractions ×100, NVLink GB/s from canonical bytes/second ÷1e9. A series is skipped (not zero-filled) whenever its canonical source is
None.- Parameters:
history (HistoryStore)
records (Iterable[ComputedRecord])
- Return type:
None
- class kempnerpulse.present.GpuProcess[source]¶
Bases:
objectA single compute process running on a GPU (for the Job View).
- kempnerpulse.present.resolve_columns(spec)[source]¶
Resolve an export spec to an ordered list of
(name, extractor).specis"default","all", or a comma-separated list of column names. Unknown names raiseUnknownExportColumns(the caller decides how to surface it — this layer does not exit the process).
- kempnerpulse.present.csv_header(columns)[source]¶
The header row (column names) for a resolved column list.
- kempnerpulse.present.csv_row(record, timestamp, columns)[source]¶
One CSV row for
recordattimestampover the resolved columns.
- exception kempnerpulse.present.UnknownExportColumns[source]¶
Bases:
ValueErrorOne or more requested export columns are not in the registry.
Modules
Keyboard command handling and the raw-terminal context manager. |
|
CSV export — the column registry keyed to |
|
Display formatting, styling, and canonical→display unit conversion. |
|
Per-GPU rolling time-series store and the record→series adapter. |
|
Dashboard assembly: the footer, the render-context, and |
|
Rich panels and the line-plot renderable. |