You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed in much of the code where I use progress, I also give some feedback about throughput and duration.
I tried to recode this so that I was delegating this to the Progress/Infinite object, but two basic problems prevented this:
The elapsed property is cast to int so that it cannot be used for accurate duration and throughput calculations
The "timer" keeps running after the progress has been finished.
A solution to both is as follows:
use monotonic() when finish method is called and initialize an attribute called end_ts
add a duration attribute that returns self.end_ts - self.start_ts, and is not cast to int
document that users should used duration rather than elapsed
I also wonder whether you should switch to perf_counter() from monotonic() at this point, but I am not sure whether in CPython or pypy there is any practical difference.
The text was updated successfully, but these errors were encountered:
progress.finish()
count=progress.indexduration=progress.durationtput=count/durationprint(f'\nProcessed {count} records in {duration:.1f} seconds ({tput:.1f} per second)', file=sys.stderr)
I noticed in much of the code where I use progress, I also give some feedback about throughput and duration.
I tried to recode this so that I was delegating this to the Progress/Infinite object, but two basic problems prevented this:
A solution to both is as follows:
monotonic()
when finish method is called and initialize an attribute calledend_ts
duration
attribute that returnsself.end_ts - self.start_ts
, and is not cast to intI also wonder whether you should switch to perf_counter() from monotonic() at this point, but I am not sure whether in CPython or pypy there is any practical difference.
The text was updated successfully, but these errors were encountered: