From 710fc9fe81ca259ad058c56b292049da3a097215 Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 24 Feb 2022 00:34:08 -0500 Subject: [PATCH 1/2] update README with added options --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fc511dc..b59ba65 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ use responsibly. ``` usage: impatient [-h] [-f FINAL] [-i INTERVAL] [-w WINDOW] [-d DECAY] - (-p PATH | -c COMMAND) + [-V FRACTION] [-I COUNT] [-l PATH] (-p PATH | -c COMMAND) Display progress and time estimates for arbitrary tasks @@ -55,6 +55,20 @@ optional arguments: Decay coefficient for older samples (default 1). Must be between 0 and 1 inclusive. The lower this is, the more responsive/swingy the estimate will be. + -V FRACTION, --termination-value-threshold FRACTION + Fraction of the expected final value that must be + reached in order to terminate (default 0.95). Reaching + this threshold is necessary but not sufficient, see + also -I + -I COUNT, --termination-inactivity-threshold COUNT + Number of consecutive unchanged samples that must be + observed in order to terminate (default 10). Reaching + this threshold is necessary but not sufficient, see + also -V + -l PATH, --log-file PATH + File to log the time series to. Will be saved as a + csv, with columns for timestamp and for value. Will + append data if the file already exists. -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 From 595c8026bf6587792e579b3a802eb244ddb760c1 Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 24 Feb 2022 00:38:04 -0500 Subject: [PATCH 2/2] make sure we have enough samples before checking termination inactivity threshold --- impatient | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/impatient b/impatient index b285cf7..0240e7e 100755 --- a/impatient +++ b/impatient @@ -132,6 +132,11 @@ while True: ), end='') sys.stdout.flush() - if final and current >= args.termination_value_threshold*final and all(d == 0 for d in deltas[-args.termination_inactivity_threshold:]): + if ( + final + and current >= args.termination_value_threshold*final + and len(deltas) >= args.termination_inactivity_threshold + and all(d == 0 for d in deltas[-args.termination_inactivity_threshold:]) + ): print() break