impatient | ||
README.md |
impatient
A general purpose utility for estimating when a task will complete
Overview
impatient
is sort of like pv
for tasks where you can't insert
extra commands into a pipeline, and sort of like progress
for tasks
that aren't reading/writing a specific file on the local system. If
you give it any shell command that outputs a number (possibly with a
K/M/G/T suffix), it will repeatedly run the command and show you how
fast that number is changing. If you give it the expected final value
of the number, it'll also estimate how much longer you have to wait.
It also has a specific option for tracking the total size of a
file or directory as given by du
.
For example, here's impatient
tracking an in-progress zfs send
to
a remote machine:
$ impatient -f "$(zfs list -pH -o used pool/home)" -c 'ssh remote-server zfs list -pH -o used remote-pool/backups/pool/home' -i 60
109.8G - 2.8M/s - 263.7G total - 41.6% complete - 15h03m remaining - ETA 2021-11-23 11:34
Note that -f
is given the value output by zfs list
; we could
give it a number directly, this just simplifies things in this
particular scenario. The -p
flag for zfs list
isn't strictly
necessary, impatient
can parse values like 50.7G
, but
using the exact byte value provides more precision.
-c
, on the other hand, is given a quoted string containing a
command, which will output the current progress value each time it's
run. The command given to -c
can be an arbitrary shell one-liner,
use responsibly.
Usage
usage: impatient [-h] [-f FINAL] [-i INTERVAL] [-w WINDOW] (-p PATH | -c COMMAND)
Display progress and time estimates for arbitrary tasks
optional arguments:
-h, --help show this help message and exit
-f FINAL, --final FINAL
Expected final size/value at completion, optionally with a K/M/G/T suffix
-i INTERVAL, --interval INTERVAL
Interval in seconds between samples (default 10)
-w WINDOW, --window WINDOW
Number of samples to keep for the sliding window (default 100)
-p PATH, --path PATH Track total disk usage of a given path
-c COMMAND, --command COMMAND
Track value returned by a shell command; this should return a single number, optionally with a K/M/G/T suffix