From 42b0b1bf051cae710908f4757b800fc8bae40820 Mon Sep 17 00:00:00 2001 From: Samuel Brand Date: Thu, 7 Mar 2024 12:16:04 +0000 Subject: [PATCH] Add warning about fail of all initial pathfinder runs --- EpiAware/src/inference-methods.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/EpiAware/src/inference-methods.jl b/EpiAware/src/inference-methods.jl index 516b650c3..9b47397d9 100644 --- a/EpiAware/src/inference-methods.jl +++ b/EpiAware/src/inference-methods.jl @@ -1,4 +1,5 @@ """ + Run pathfinder multiple times and store the results in an array. Fails safely. # Arguments @@ -39,6 +40,9 @@ of tries is reached. """ function _continue_manypathfinder!(pfs, mdl::DynamicPPL.Model; max_tries, kwargs...) tryiter = 1 + if all(pfs .== :fail) + @warn "All initial pathfinder runs failed, trying again for $max_tries tries." + end while all(pfs .== :fail) && tryiter <= max_tries new_pf = try pathfinder(mdl; kwargs...) @@ -49,7 +53,8 @@ function _continue_manypathfinder!(pfs, mdl::DynamicPPL.Model; max_tries, kwargs tryiter += 1 end if all(pfs .== :fail) - @warn "All pathfinder runs failed" + @warn "All pathfinder runs failed after $max_tries tries. Returning failed + pathfinder." end return pfs end