rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Reset ongoing bar (quantifying mode) #59

Open CharlieCheckpt opened 4 years ago

CharlieCheckpt commented 4 years ago

Hello,

Thank you for this package, animations are really cool.

I would like to display several times progress bar, and clear the previous progress bar before starting the new one. It seems not possible to clear a progress bar once it's finished or did I miss something ?

for epoch in range(10):
    with alive_bar(100, bar="blocks", title=f"[Epoch: {epoch}]") as bar:
        for i in range(100):
            time.sleep(0.01)
            bar()

image

Thanks

rsalmei commented 4 years ago

Hello @CharlieCheckpt, thank you man! I'm glad you liked them!

I didn't quite get it, you are asking how to "clear the previous progress bar". Does that mean you'd like to see the line entirely cleared, so as skipping a line, then running the new progress bar and skipping its line again, and ending up with 10 blank lines? If it is, it really is not possible, I always put a receipt at the end, to mark that processing as finished, and see its stats like count, elapsed time and throughput.

I have another feature implemented, but not yet released, that will enable you to reset an ongoing bar, I think that is what you really wanted, right? That way, all bars would be rendered in the same line, with new titles and progresses and stats! It is in a stash for now, I need to finalize #51 before thinking of returning to it. But should be soon, stay tuned! 👍

rsalmei commented 4 years ago

This even gives me an idea... If someone really does want to use the future reset() like that, with several different processings happening, it would be weird to print the final receipt with only the last data. Maybe in addition to it, there could be a memory(), to reset but remember internally what did happen, so the final print receipt could include all the data of all the processings! Do you think that could be useful?

CharlieCheckpt commented 4 years ago

Thank you for this quick answer @rsalmei !

You're right, I was thinking actually of resetting an ongoing bar. That's great if you already thought about it :)

For what I am specifically doing, only getting receipt of last data is okay. I am logging training metrics at each step with mlflow, so I can visualize the metrics history in a separate window. But having a memory() feature could definitely be useful to visualize metrics history directly in the terminal. I am sure there are other tasks where this would be very relevant.

mxrch commented 2 years ago

Hello, up ! :) Isn't there now a simple way to delete the progress bar once it's finished ?

rsalmei commented 2 years ago

What do you mean? I didn't quite get it.

rsalmei commented 2 years ago

@mxrch If you meant not to print the final receipt once the processing is finished, this is done! Should be released today.

Quantifying mode is still on that stash... 😓

mxrch commented 2 years ago

@mxrch If you meant not to print the final receipt once the processing is finished, this is done! Should be released today.

Quantifying mode is still on that stash... 😓

It was exactly what I meant, thank you very much for your work ! 😊

rsalmei commented 2 years ago

You're welcome! 👍

mxrch commented 2 years ago

@rsalmei Thank you it works very well !

TheTechRobo commented 2 years ago

I don't think that quantifying mode has been implemented. The thing you want has, but just because you have gotten your answer doesn't mean the issue author's feature request is finished.

mxrch commented 2 years ago

@TheTechRobo Yes, I didn't see that quantifying mode is not done yet. :)