Skip to content

CMLDEV-1207: expose per-node QUEUED/STARTED/BOOTED times in PCL#225

Merged
tmikuska merged 1 commit into
devfrom
CMLDEV-1207-expose-per-node-booted-started-queued-times-pcl
May 12, 2026
Merged

CMLDEV-1207: expose per-node QUEUED/STARTED/BOOTED times in PCL#225
tmikuska merged 1 commit into
devfrom
CMLDEV-1207-expose-per-node-booted-started-queued-times-pcl

Conversation

@tmikuska
Copy link
Copy Markdown
Collaborator

The Python Client Library was discarding the times block from /labs/{id}/simulation_stats, so callers had no way to ask "how long has this node been booted?" -- see #87.

Changes:

  • Lab.sync_statistics now stores the controller's times dict alongside cpu_usage / disk_read / disk_write.
  • Node gains times, boot_time, started_time, queued_time properties. The convenience properties return 0 when the node has not reached that state, matching the controller's own convention.
  • Lab gains uptime: smallest non-zero STARTED marker across all nodes, useful as an abandoned-lab signal. Returns 0 when no node has started.
  • Drive-by: keep the defensive _get_element_from_data reads for cpu_usage / block0_* so partial payloads from external connectors, unmanaged switches, and queued nodes (which only carry times + is_running) don't blow up sync_statistics on v2.9 / v2.10 servers either.

Tests cover the new properties, the partial-payload case, and the uptime aggregation.

The Python Client Library was discarding the `times` block from
`/labs/{id}/simulation_stats`, so callers had no way to ask
"how long has this node been booted?" -- see #87.

Changes:
* Lab.sync_statistics now stores the controller's `times` dict
  alongside cpu_usage / disk_read / disk_write.
* Node gains `times`, `boot_time`, `started_time`, `queued_time`
  properties. The convenience properties return 0 when the node has
  not reached that state, matching the controller's own convention.
* Lab gains `uptime`: smallest Node.started_time across the lab's
  nodes, useful as an abandoned-lab signal. Returns 0 if any node
  is not running (including the empty-lab case).
* Drive-by: keep the defensive `_get_element_from_data` reads for
  `cpu_usage` / `block0_*` so partial payloads from external
  connectors, unmanaged switches, and queued nodes (which only
  carry `times` + `is_running`) don't blow up sync_statistics on
  v2.9 / v2.10 servers either.

Tests cover the new properties, the partial-payload case, and the
uptime aggregation.
@tmikuska tmikuska force-pushed the CMLDEV-1207-expose-per-node-booted-started-queued-times-pcl branch from 63436c8 to 9a800a0 Compare May 11, 2026 22:27
@tmikuska tmikuska merged commit 1770d17 into dev May 12, 2026
5 checks passed
@tmikuska tmikuska deleted the CMLDEV-1207-expose-per-node-booted-started-queued-times-pcl branch May 12, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants