-
Notifications
You must be signed in to change notification settings - Fork 19
Progress bars when sampling multiple chains #168
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
Changes from 2 commits
b3434ac
15250c7
367718b
60134f8
e0ae513
6b514e4
bbda3c8
a9e5306
a03692d
838db60
6b59b21
b340ebc
1195503
594483f
7def4b4
022678e
5b2577f
cefafb0
c6f9e78
d9c2e86
f8a8b64
64b0bfb
27569b3
4cd647a
9f8970d
3e43f6a
7276fc2
284741f
5c5b912
eebb10b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,13 @@ struct CreateNewProgressBar{S<:AbstractString} <: AbstractProgressKwarg | |
return new{typeof(name)}(name, UUIDs.uuid4()) | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the below functions have a trailing (Doesn't really matter, we just as well leave the names as is) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, they are mutating (although the macro hides the worst of it). Will change. |
||
function init_progress(p::CreateNewProgressBar) | ||
function init_progress!(p::CreateNewProgressBar) | ||
ProgressLogging.@logprogress p.name nothing _id = p.uuid | ||
end | ||
function update_progress(p::CreateNewProgressBar, progress_frac) | ||
function update_progress!(p::CreateNewProgressBar, progress_frac) | ||
ProgressLogging.@logprogress p.name progress_frac _id = p.uuid | ||
end | ||
function finish_progress(p::CreateNewProgressBar) | ||
function finish_progress!(p::CreateNewProgressBar) | ||
ProgressLogging.@logprogress p.name "done" _id = p.uuid | ||
end | ||
|
||
|
@@ -34,9 +34,9 @@ end | |
Do not log progress at all. | ||
""" | ||
struct NoLogging <: AbstractProgressKwarg end | ||
init_progress(::NoLogging) = nothing | ||
update_progress(::NoLogging, ::Any) = nothing | ||
finish_progress(::NoLogging) = nothing | ||
init_progress!(::NoLogging) = nothing | ||
update_progress!(::NoLogging, ::Any) = nothing | ||
finish_progress!(::NoLogging) = nothing | ||
|
||
""" | ||
ExistingProgressBar | ||
|
@@ -51,7 +51,7 @@ struct ExistingProgressBar{S<:AbstractString} <: AbstractProgressKwarg | |
name::S | ||
uuid::UUIDs.UUID | ||
end | ||
function init_progress(p::ExistingProgressBar) | ||
function init_progress!(p::ExistingProgressBar) | ||
# Hacky code to reset the start timer if called from a multi-chain sampling | ||
# process. We need this because the progress bar is constructed in the | ||
# multi-chain method, i.e. if we don't do this the progress bar shows the | ||
|
@@ -65,10 +65,10 @@ function init_progress(p::ExistingProgressBar) | |
end | ||
ProgressLogging.@logprogress p.name nothing _id = p.uuid | ||
end | ||
function update_progress(p::ExistingProgressBar, progress_frac) | ||
function update_progress!(p::ExistingProgressBar, progress_frac) | ||
ProgressLogging.@logprogress p.name progress_frac _id = p.uuid | ||
end | ||
function finish_progress(p::ExistingProgressBar) | ||
function finish_progress!(p::ExistingProgressBar) | ||
ProgressLogging.@logprogress p.name "done" _id = p.uuid | ||
end | ||
|
||
|
@@ -87,11 +87,11 @@ struct ChannelProgress{T<:Union{Channel{Bool},Distributed.RemoteChannel{Channel{ | |
channel::T | ||
n_updates::Int | ||
end | ||
init_progress(::ChannelProgress) = nothing | ||
update_progress(p::ChannelProgress, ::Any) = put!(p.channel, true) | ||
init_progress!(::ChannelProgress) = nothing | ||
update_progress!(p::ChannelProgress, ::Any) = put!(p.channel, true) | ||
# Note: We don't want to `put!(p.channel, false)`, because that would stop the | ||
# channel from being used for further updates e.g. from other chains. | ||
finish_progress(::ChannelProgress) = nothing | ||
finish_progress!(::ChannelProgress) = nothing | ||
|
||
# Add a custom progress logger if the current logger does not seem to be able to handle | ||
# progress logs. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "same as
:none
"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also "use
:perchain
for 10 or fewer chains, and:overall
" 😅There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed.