ProgressLogging.jl
ProgressLogging.jl copied to clipboard
How can I use @logprogress inside a function called within an @withprogress macro?
Hi, I keep getting the following error when trying to call @logprogress in a function call to update a progress bar inside @withprogress wrapping my main execution loop, it works fine when the @logprogress is in this main loop level, but fails with the following error when I try to update progress within a function call in the loop:
ERROR: `@logprogress` must be used inside `@withprogress` or with `_id` keyword argument
I am not sure how I can pass this _id kwarg, I tried doing:
progress && ProgressLogging.@logprogress _id=progress_id t / Ntotal
But it doesn't change anything, any help would be appreciated
Pretty sure that's just a bug which should be fixed by #41.
Great thank you, so once it is merged, will the usage be to specify a parentid on the @withprogress call, then _id on the @logprogress calls? And the ID should presumably be the result of say: UUIDs.uuid1(Random.GLOBAL_RNG) for example?
Just something like
@logprogress 0.2 _id=3 # it's up to you to ensure that "3" is unique :)
should do the trick. We have a global ID which will be used instead of the parentid with #41.
Sorry could you clarify on that last part what you mean about using a global ID instead of parentid? Other than that sounds great though thanks for sorting it so quickly