ProgressLogging.jl icon indicating copy to clipboard operation
ProgressLogging.jl copied to clipboard

alternative to `fraction` field for progress on open-ended tasks

Open goretkin opened this issue 4 years ago • 0 comments

The Progress type has a fraction field, and I am considering an alternative that stores two quantities e.g. completed and total, which conceptually are just the numerator and denominator of the fraction.

Having that structure, however, allows the denominator to take on a sentinel value (perhaps 0, perhaps -1, perhaps missing) in order to log progress on tasks with an unknown amount of steps.

I think it's a worthwhile idea to explore.

The Progress type could acquire additional fields, and keep the fraction field redundantly. This would keep e.g. VSCodeServer working.

I would prefer not keeping this redundant information, but the default behavior for serializing the object is based on fieldnames not propertynames: https://github.com/JuliaIO/JSON.jl/blob/4b3913d58f04cc5bb2f8d23c6ef82e0fbed20525/src/Writer.jl#L23

Furthermore, VSCodeServer.jl vendors JSON.jl, so avoiding the redundant information would require a modification to VSCodeServer.jl itself. I think that's the winning solution, but perhaps there's an alternative that I am missing.

Related: https://github.com/JunoLab/ProgressLogging.jl/issues/27#issuecomment-788614996

goretkin avatar Mar 02 '21 20:03 goretkin