From 5a66c02eb118bea60989bd7b57e26c6844d409b3 Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Fri, 29 Sep 2023 14:53:26 +0200 Subject: [PATCH] log progress with configurable ID --- src/integrators/integrator_utils.jl | 4 ++-- src/integrators/type.jl | 1 + src/solve.jl | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/integrators/integrator_utils.jl b/src/integrators/integrator_utils.jl index cdc80406fd..ac12022bfe 100644 --- a/src/integrators/integrator_utils.jl +++ b/src/integrators/integrator_utils.jl @@ -151,7 +151,7 @@ function _postamble!(integrator) if integrator.opts.progress @logmsg(LogLevel(-1), integrator.opts.progress_name, - _id=:OrdinaryDiffEq, + _id=integrator.opts.progress_id, message=integrator.opts.progress_message(integrator.dt, integrator.u, integrator.p, integrator.t), progress="done") @@ -269,7 +269,7 @@ function _loopfooter!(integrator) t1, t2 = integrator.sol.prob.tspan @logmsg(LogLevel(-1), integrator.opts.progress_name, - _id=:OrdinaryDiffEq, + _id=integrator.opts.progress_id, message=integrator.opts.progress_message(integrator.dt, integrator.u, integrator.p, integrator.t), progress=(integrator.t - t1) / (t2 - t1)) diff --git a/src/integrators/type.jl b/src/integrators/type.jl index 070f098816..6f96de274a 100644 --- a/src/integrators/type.jl +++ b/src/integrators/type.jl @@ -30,6 +30,7 @@ mutable struct DEOptions{absType, relType, QT, tType, Controller, F1, F2, F3, F4 progress_steps::Int progress_name::String progress_message::F6 + progress_id::Symbol timeseries_errors::Bool dense_errors::Bool dense::Bool diff --git a/src/solve.jl b/src/solve.jl index d0e77c59e0..3fa4c67f82 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -63,6 +63,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem, progress_steps = 1000, progress_name = "ODE", progress_message = ODE_DEFAULT_PROG_MESSAGE, + progress_id = gensym("OrdinaryDiffEq"), userdata = nothing, allow_extrapolation = alg_extrapolates(alg), initialize_integrator = true, @@ -99,7 +100,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem, @warn("Dense output is incompatible with saveat. Please use the SavingCallback from the Callback Library to mix the two behaviors.") end - progress && @logmsg(LogLevel(-1), progress_name, _id=_id = :OrdinaryDiffEq, progress=0) + progress && @logmsg(LogLevel(-1), progress_name, _id=progress_id, progress=0) tType = eltype(prob.tspan) tspan = prob.tspan @@ -380,6 +381,7 @@ function DiffEqBase.__init(prob::Union{DiffEqBase.AbstractODEProblem, progress_steps, progress_name, progress_message, + progress_id, timeseries_errors, dense_errors, dense, save_on, save_start,