-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New progress logging interface? #7
Comments
Agreed.
continues to work. |
Thinking about this and #8, I started wondering if it makes sense to use a single key like this @logmsg ProgressLevel name progress=Progress(0.1, id, parentid) where Base.@kwdef struct Progress
progress::Float64
id::UUID
parentid::UUID = UUID(0) # not nested by default
end This has some benefits:
Maybe it makes sense to put above struct in ProgressBase.jl, since this is what both frontend and backend need while backends do not need |
I like it. for i in 0:0.1:1
sleep(0.5)
@logmsg -1 "foo" progress=@Progress(0.1) # This sets id to something based on __source__.
end IMHO we should also keep all other kwargs supplied to |
Instead of @withprogress begin
for i = 1:10
sleep(0.5)
@logprogress "iterating" progress=i/10
end
end I think Thinking this a bit more, I wonder if we should only expose a smaller @logprogress progress [message=value] [right_text=value] which would be used as @withprogress name="iterating" begin
for i = 1:10
sleep(0.5)
if i == 10
@logprogress i/10 message="this is the last one"
else
@logprogress i/10
end
end
end (where This way, we can be more flexible about the upgrade path to |
Since |
Yeah,
Mh, fair enough, I suppose. |
Do you think |
Currently,
Imho it's very useful to be able to change the progress bar's name. I'd also kinda like it if the |
Thanks for the demo. I see. It makes sense to support changing the name. So, how about this syntax? @logprogress [name] progress [key1=val1 [key2=val2 ...]] i.e., make
I think I understand the benefit but I'm a bit ambivalent about this direction. But we are going to have a phase supporting both specs anyway if we are to switch to |
I agree that dynamic Hmm, concurrent tasks would get the same id when running a given loop which is annoying. That could be dealt with by adding a task id and using The |
I had the same thought. But actually you only need a recursive function to break macro-based foreachprod(f) = f(())
function foreachprod(f, it, itrs...)
for (i, x) in enumerate(it)
@info "foreachprod" progress = i / length(it)
foreachprod(itrs...) do y
f((x, y...))
end
end
end This function requires nested bars but produces only one Another example from https://tkf.github.io/Transducers.jl/dev/manual/#Transducers.withprogress: xf = MapCat() do x
withprogress(1:x; interval=1e-3) # nested progress
end |> Map() do x
sleep(0.5)
x
end
foldl(+, xf, withprogress(1:10; interval=1e-3))
So I've been assuming that it has to be a symbol. Maybe we should fix the doc, if this is not indented? |
Oh! You're completely right about that.
Yes we should; this must be a leftover from earlier versions. As of julia-1.0, depwarns use an |
Quoting @c42f's comment
|
Edit: Originally it was about using
gensym
for_id
. But it turned out there are many aspects that may require re-design.IMHO using
gemsym
dynamically is not really the best practice as it leaks memory. It also is slow compared to (say) UUIDThese are not very critical problems but it's nice if we can avoid it. I think we can easily avoid it by introducing a new key value (say)
progressid
such thatis used instead of
Then
id
can be of any type. The easiest thing to use may beuuid4()
.The text was updated successfully, but these errors were encountered: