r-lib / progress

Progress bar in your R terminal
http://r-lib.github.io/progress/
Other
468 stars 39 forks source link

Allow 'total = NULL' or 'total = Inf'? #48

Closed kevinushey closed 6 years ago

kevinushey commented 7 years ago

For progress bars with an unknown number of total ticks, it'd be nice to be able to express that directly by setting total to some proxy value. (Of course, one alternative is to just pick a very large total, e.g. setting it to 1E7)

In a similar vein, it might be nice to have a 'finalize' method, to be called on the progress bar to indicate that whatever operation you were tracking is done. It would be semantically equivalent to update(1), I think?

gaborcsardi commented 7 years ago

Both good ideas. I think for unknown number of ticks, we should just allow NA.

The finalizer might be tricky, because potentially it called much later than finishing the process. One thing we could do is to require that either the ticks sum up to total, or there is an explicit update(1) call, for successful termination. Otherwise we would assume an error or interruption, and would act accordingly in the finalizer. But it is still challenging, because there is probably an error message on the screen already, or sg else, in these cases.

jimhester commented 7 years ago

As of https://github.com/r-lib/progress/commit/0ad40c98f7b1918c7016271c52e0c0c74022fdda we now have a public terminate method, which addresses part of this.