I'm running a very long process, and iterating by
with tqdm(total=N) as pbar:
time.sleep(1)
pbar.update(1)
displays something like
0%| | 528912/1.1579208923731618e+77 [00:05<320918211271131291051900907686223146304413317191111137850058393514584:44:48, 100226.38it/s
[Quite a big combinatorial process, I'm dealing with :S ]
I will certainly try to optimize it and decrease the search-space (which I think I really cannot), but anyway, I'm curious whether if the 320918211271131291051900907686223146304413317191111137850058393514584
number of hours could be expressed as number of years + remaining days + remaining hours + remaining minutes + remaning seconds.
Any idea on how can this be achieved?
I certainly love tqdm, but it doesn't seem easy to customize.
Thanks in advance!
It's been a while, but for the sake of completiness, here it goes:
class TqdmExtraFormat(tqdm):
@property
def format_dict(self):
d = super(TqdmExtraFormat, self).format_dict
rate = d["rate"]
remaining_secs = (d["total"] - d["n"]) / rate if rate and d["total"] else 0
my_remaining = seconds_to_time_string(remaining_secs)
d.update(my_remaining=(my_remaining))
return d
b = '{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{my_remaining}, {rate_fmt}{postfix}]'
jobs_list = range(1,1000000)
for i in TqdmExtraFormat(jobs_list, bar_format=b):
time.sleep(0.01)