loqs.tools.monitor.cli¶
loqs-monitor console script: watch the workers of a running
multi-program dispatch from its item checkpoint directory.
loqs-monitor <item_checkpoint_dir> [--interval SECONDS] [--stale-after SECONDS]
[--by-host] [--host PATTERN ...] [--once]
Live mode (the default) shows a rich table refreshed every --interval
seconds until Ctrl-C; it needs rich (pip install "loqs[parallel]").
--once prints one plain-text snapshot and needs no rich.
Both modes render the same rows, built by one shared formatting helper.
Classes¶
Attributes¶
Functions¶
aggregate_by_host ¶
aggregate_by_host(workers: Iterable[WorkerSummary]) -> list[HostRow]
One HostRow per host, sorted alphabetically by host.
filter_hosts ¶
filter_hosts(snapshot: MonitorSnapshot, patterns: Sequence[str]) -> tuple[MonitorSnapshot, int | None]
Keep the workers whose host matches any glob in patterns.
Matching is case-sensitive (fnmatch.fnmatchcase). Returns the
filtered snapshot, with totals recomputed and a note for each pattern
that matched no host, and the number of hosts before filtering. With no
patterns the snapshot is returned unchanged, with None for the count.
format_age ¶
format_age(seconds: float | None) -> str
Compact duration such as 45s, 3m12s or 2h05m; "-" for None.
format_plain ¶
format_plain(snapshot: MonitorSnapshot, *, by_host: bool = False, hosts_total: int | None = None) -> str
Plain-text rendering of a snapshot, per worker or per host.
format_rows ¶
format_rows(snapshot: MonitorSnapshot) -> list[tuple[str, ...]]
One row of strings per worker, in the snapshot's host-then-pid order.
format_summary ¶
format_summary(snapshot: MonitorSnapshot, hosts_total: int | None = None) -> list[str]
The lines shown above the rows.
With hosts_total, adds a Showing N of M hosts line.