Skip to content

Commit 7d0ef16

Browse files
Andrey Cheptsovclaude
andcommitted
Drop docstrings that summarise the code they sit on
Five of the six in this module restated what the function below already said, or argued for the option taken over one that was not. The remaining one records that the server sends samples newest-first, which is a fact from outside this file and draws every chart backwards if missed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 0fcad27 commit 7d0ef16

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

src/dstack/_internal/cli/utils/metrics.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ def get_metrics_table(
7373

7474

7575
def job_labels(jobs: Sequence[Job]) -> List[str]:
76-
"""`replica=`/`group=` only where they distinguish something, as `dstack ps` does --
77-
one replica across four nodes is `job=0..3`, not `replica=0 job=0..3`.
78-
79-
Unlike `ps`, `job=` is always printed. This table is keyed by job, so every row names
80-
one; `replica=` joins it only where there is more than one replica to tell apart.
81-
"""
8276
groups = {job.job_spec.replica_group for job in jobs}
8377
show_group = len(groups) > 1
8478
show_replica = len({job.job_spec.replica_num for job in jobs}) > 1
@@ -125,13 +119,6 @@ def _add_job(
125119

126120

127121
def _span(metrics: Sequence[JobMetrics]) -> Optional[tuple[datetime, datetime]]:
128-
"""The window every job is drawn against: always the full retention hour.
129-
130-
Fixed rather than fitted to the data, so a row means the same thing in every
131-
invocation and across every job. A job younger than the hour fills only its share of
132-
the row and the rest is blank -- which is the fact worth seeing about a replica that
133-
started two minutes ago.
134-
"""
135122
windows = [w for w in (_window(m) for m in metrics) if w is not None]
136123
if not windows:
137124
return None
@@ -140,7 +127,6 @@ def _span(metrics: Sequence[JobMetrics]) -> Optional[tuple[datetime, datetime]]:
140127

141128

142129
def _lead(metrics: JobMetrics, span: Optional[tuple[datetime, datetime]], width: int) -> int:
143-
"""Cells before this job's first sample -- time it was not running for."""
144130
window = _window(metrics)
145131
if window is None or span is None:
146132
return 0
@@ -214,18 +200,6 @@ def _cell(spark: Text, label: str) -> Text:
214200

215201

216202
def _axis(width: int, first: datetime, last: datetime) -> Text:
217-
"""`<oldest> ┄┄┄ <newest>`, never wider than the sparkline above it.
218-
219-
The rule is what pairs the two stamps. UTILIZATION and MEMORY each print one, so the
220-
row ends up holding four times, and with the rule left blank the only cue is spacing --
221-
which points the wrong way above 88 columns: at 200 there are 66 blanks between a
222-
column's own two stamps but only 13 between the columns, so each column's newest time
223-
reads as belonging to the next column's oldest.
224-
225-
A run draws one cell per sample, so for its first few minutes there are fewer cells
226-
than two dates need. Dropping the date keeps the axis inside its cell; overflowing
227-
instead widens the column and pulls MEMORY out of line with the charts.
228-
"""
229203
left, right = _stamp(first), _stamp(last)
230204
if len(left) + len(right) + 3 > width:
231205
left, right = _stamp(first, clock_only=True), _stamp(last, clock_only=True)
@@ -250,8 +224,6 @@ def _window(job_metrics: JobMetrics) -> Optional[tuple[datetime, datetime]]:
250224

251225

252226
def _samples_num(job_metrics: JobMetrics) -> int:
253-
"""`slices` never draws more cells than it has samples, so the axis must stop there
254-
too -- else it claims a span nothing was measured over, and Rich widens the column."""
255227
return max((len(metric.timestamps) for metric in job_metrics.metrics), default=0)
256228

257229

0 commit comments

Comments
 (0)