better handling of stalled/overfilled tasks
This commit is contained in:
parent
4cf9fb137b
commit
ad995b0845
10
impatient
10
impatient
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
|
import math
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -94,8 +95,13 @@ while True:
|
||||||
fraction = current / final
|
fraction = current / final
|
||||||
value_remaining = final - current
|
value_remaining = final - current
|
||||||
print(' - {} total - {:.1f}% complete'.format(display_value(final), 100*fraction), end='')
|
print(' - {} total - {:.1f}% complete'.format(display_value(final), 100*fraction), end='')
|
||||||
if rate > 0:
|
seconds_remaining = (value_remaining / rate) if rate > 0 else math.inf
|
||||||
time_remaining = datetime.timedelta(seconds=(value_remaining / rate))
|
if seconds_remaining < 0:
|
||||||
|
print(' - unknown time remaining', end='')
|
||||||
|
elif seconds_remaining > 864000:
|
||||||
|
print(' - stalled', end='')
|
||||||
|
else:
|
||||||
|
time_remaining = datetime.timedelta(seconds=seconds_remaining)
|
||||||
eta = datetime.datetime.now() + time_remaining
|
eta = datetime.datetime.now() + time_remaining
|
||||||
print(' - {} remaining - ETA {}'.format(
|
print(' - {} remaining - ETA {}'.format(
|
||||||
display_timedelta(time_remaining),
|
display_timedelta(time_remaining),
|
||||||
|
|
Loading…
Reference in a new issue