Skip to content

Commit

Permalink
ignore derivatives of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Pepijn de Vos committed Oct 30, 2023
1 parent d4de969 commit 15acc1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ensemble/basic_ensemble_solve.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Logging
using Logging, ChainRulesCore
"""
$(TYPEDEF)
"""
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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...)

Check warning on line 86 in src/ensemble/basic_ensemble_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/ensemble/basic_ensemble_solve.jl#L86

Added line #L86 was not covered by tests
end # ignore_derivatives
end
Logging.shouldlog(l::AggregateLogger, args...) = Logging.shouldlog(l.logger, args...)

Check warning on line 89 in src/ensemble/basic_ensemble_solve.jl

View check run for this annotation

Codecov / codecov/patch

src/ensemble/basic_ensemble_solve.jl#L89

Added line #L89 was not covered by tests
Logging.min_enabled_level(l::AggregateLogger) = Logging.min_enabled_level(l.logger)
Expand Down

0 comments on commit 15acc1b

Please sign in to comment.