From 15acc1ba24daf8271cf9f34b2e546b06ac8b4401 Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Mon, 30 Oct 2023 10:05:12 +0100 Subject: [PATCH] ignore derivatives of logging --- src/ensemble/basic_ensemble_solve.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ensemble/basic_ensemble_solve.jl b/src/ensemble/basic_ensemble_solve.jl index 6187a82bf8..adc3b8b5cc 100644 --- a/src/ensemble/basic_ensemble_solve.jl +++ b/src/ensemble/basic_ensemble_solve.jl @@ -1,4 +1,4 @@ -using Logging +using Logging, ChainRulesCore """ $(TYPEDEF) """ @@ -41,6 +41,7 @@ end AggregateLogger(logger::AbstractLogger) = AggregateLogger(Dict{Symbol, Float64}(),0 , 0.0, 0.0, ReentrantLock(), logger) function Logging.handle_message(l::AggregateLogger, level, message, _module, group, id, file, line; kwargs...) + @ignore_derivatives begin if convert(LogLevel, level) == LogLevel(-1) && haskey(kwargs, :progress) pr = kwargs[:progress] if trylock(l.lock) || (pr == "done" && lock(l.lock)===nothing) @@ -83,6 +84,7 @@ function Logging.handle_message(l::AggregateLogger, level, message, _module, gro end end Logging.handle_message(l.logger, level, message, _module, group, id, file, line; kwargs...) + end # ignore_derivatives end Logging.shouldlog(l::AggregateLogger, args...) = Logging.shouldlog(l.logger, args...) Logging.min_enabled_level(l::AggregateLogger) = Logging.min_enabled_level(l.logger)