Show the progress rate over the last 5 seconds, and what a phase is doing after 10 seconds with no item done (closes #125)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The rate was the phase's average, so a burst after a long wait read as over 1,000 files a second. It now covers the items completed over the last 5 seconds, or since the line before off a terminal; the ETA still comes from the average. Once no item has completed for 10 seconds, the rate gives way to "stalled" and what the phase is doing, as "stalled reading", kept whole with the phase, progress, elapsed time and ETA, so only the bar gives way before them. report's read phase says "read/write", as it writes the report while it reads. The tests set the display's clock by hand. Deviation: the stall words hold no time; with one, no words naming the work fit beside the rest at 80 columns. Judgement call: trees' group phase says "grouping". Model: opus-5-5
This commit is contained in:
@@ -833,17 +833,34 @@ Each display is one line holding:
|
||||
- a `[m/n] x%` display (items processed / total items, percent); before a phase
|
||||
has a total, the items processed, or what the phase is waiting for
|
||||
- current rate (items/s), naming the items the phase counts: files, records,
|
||||
directories or groups
|
||||
directories or groups. It covers the items completed over the last 5 seconds,
|
||||
or, when stderr is not a terminal, since the line before, so it falls to 0
|
||||
while nothing completes, and a burst of items after a wait shows as a burst
|
||||
rather than as a steady rate. Once no item has completed for 10 seconds, the
|
||||
word `stalled` and what the phase is doing take the rate's place (see below).
|
||||
- elapsed time
|
||||
- estimated time remaining, or `unknown`
|
||||
- estimated time remaining, or `unknown`. It comes from the phase's average rate
|
||||
since it started counting, so that it does not swing with each burst.
|
||||
|
||||
Example shape (exact layout is flexible, content is not):
|
||||
|
||||
```
|
||||
[3/5] hash: [12345/98765] 12% |████ | 92 files/s elapsed 2:32 eta 17:54
|
||||
[2/5] walk: [1234567/~1200000] 103%, 5120 files/s, elapsed 4m1s, eta unknown
|
||||
[3/5] hash: [12345/45678] 27%, stalled reading, elapsed 4m30s, eta 12m9s
|
||||
```
|
||||
|
||||
When no item has completed for 10 seconds, as while one large file is read, a
|
||||
disk is slow or the database is busy, the line says `stalled` and what the phase
|
||||
is doing in place of the rate, which would read 0: `walk` is `listing`
|
||||
directories; `hash` and the content phase's reads are `reading` files; `update`
|
||||
is `writing` to the database; `load` and the `read` phase of `trees` are
|
||||
`reading` the database; the content phase's checks are `searching` the database;
|
||||
`trees`' `group` is `grouping` directories, and its `write` is `writing` the
|
||||
report. The `read` phase of `report` writes the report while it reads the
|
||||
records and may be waiting on either, so it says `read/write`. A phase still
|
||||
waiting for its total already says what it waits for, and says nothing more.
|
||||
|
||||
Additional requirements:
|
||||
|
||||
- On a terminal, a phase with an exact total (every phase but `scan`'s `walk`,
|
||||
@@ -855,15 +872,18 @@ Additional requirements:
|
||||
times a second, so its elapsed time keeps moving while a phase waits for its
|
||||
next item.
|
||||
- On a terminal no line reaches the terminal's last column, however narrow the
|
||||
terminal is. The phase and its place, the progress, the elapsed time and the
|
||||
ETA are kept whole: a line too wide for the terminal leaves out its rate first
|
||||
(or what the phase is waiting for), and a bar with no room beside those four
|
||||
gives way to the spinner. Only when those four alone are too wide, as on a
|
||||
terminal is. The phase and its place, the progress, what a stalled phase is
|
||||
doing, the elapsed time and the ETA are kept whole: a line too wide for the
|
||||
terminal leaves out its rate (or what the phase is waiting for), and a bar
|
||||
with no room beside the parts kept whole gives way to the spinner. The words a
|
||||
stalled phase shows are short, so that a line like the stalled one in the
|
||||
example above, with tens of thousands of files and times in minutes, fits on
|
||||
an 80-column terminal. Only when the parts kept whole are too wide, as on a
|
||||
terminal narrower than about 70 columns hours into a scan of millions of
|
||||
files, is the line cut short at the terminal's edge, so the end of the ETA is
|
||||
lost first. A terminal made narrower while a phase runs gets the same: the
|
||||
next draw erases the line within the new width and fits the line to it, and
|
||||
the display goes on redrawing in place.
|
||||
files, or about 90 once the phase has stalled, is the line cut short at the
|
||||
terminal's edge, so the end of the ETA is lost first. A terminal made narrower
|
||||
while a phase runs gets the same: the next draw erases the line within the new
|
||||
width and fits the line to it, and the display goes on redrawing in place.
|
||||
- When stderr is not a terminal (a pipe, a file, `/dev/null`), do not emit ANSI
|
||||
redraws: print the line the moment each phase starts, every 5 seconds while it
|
||||
runs (whether or not an item has completed, and never more often), and once
|
||||
|
||||
Reference in New Issue
Block a user