Skip to content

Commit 7532642

Browse files
Disable worker retarts for mem pressure on Mac (#115)
1 parent fb8ddef commit 7532642

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ReTestItems.jl

+9-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export TestSetup, TestItem, TestItemResult
1616
const RETESTITEMS_TEMP_FOLDER = mkpath(joinpath(tempdir(), "ReTestItemsTempLogsDirectory"))
1717
const DEFAULT_TESTITEM_TIMEOUT = 30*60
1818
const DEFAULT_RETRIES = 0
19-
const DEFAULT_MEMORY_THRESHOLD = 0.99
19+
const DEFAULT_MEMORY_THRESHOLD = Ref{Float64}(0.99)
20+
2021

2122
if isdefined(Base, :errormonitor)
2223
const errmon = Base.errormonitor
@@ -65,6 +66,11 @@ function __init__()
6566
DEFAULT_STDERR[] = stderr
6667
DEFAULT_LOGSTATE[] = Base.CoreLogging._global_logstate
6768
DEFAULT_LOGGER[] = Base.CoreLogging._global_logstate.logger
69+
# Disable killing workers based on memory pressure on MacOS til calculations fixed.
70+
# TODO: fix https://github.com/JuliaTesting/ReTestItems.jl/issues/113
71+
@static if Sys.isapple()
72+
DEFAULT_MEMORY_THRESHOLD[] = 1.0
73+
end
6874
return nothing
6975
end
7076

@@ -141,7 +147,7 @@ will be run.
141147
- `test_end_expr::Expr`: an expression that will be evaluated after each testitem is run.
142148
Can be used to verify that global state is unchanged after running a test. Must be a `:block` expression.
143149
- `memory_threshold::Real`: Sets the fraction of memory that can be in use before a worker processes are
144-
restarted to free memory. Defaults to $DEFAULT_MEMORY_THRESHOLD. Only supported with `nworkers > 0`.
150+
restarted to free memory. Defaults to $(DEFAULT_MEMORY_THRESHOLD[]). Only supported with `nworkers > 0`.
145151
For example, if set to 0.8, then when >80% of the available memory is in use, a worker process will be killed and
146152
replaced with a new worker before the next testitem is evaluated. The testitem will then be run on the new worker
147153
process, regardless of if memory pressure dropped below the threshold. If the memory pressure remains above the
@@ -198,7 +204,7 @@ function runtests(
198204
worker_init_expr::Expr=Expr(:block),
199205
testitem_timeout::Real=parse(Float64, get(ENV, "RETESTITEMS_TESTITEM_TIMEOUT", string(DEFAULT_TESTITEM_TIMEOUT))),
200206
retries::Int=parse(Int, get(ENV, "RETESTITEMS_RETRIES", string(DEFAULT_RETRIES))),
201-
memory_threshold::Real=parse(Float64, get(ENV, "RETESTITEMS_MEMORY_THRESHOLD", string(DEFAULT_MEMORY_THRESHOLD))),
207+
memory_threshold::Real=parse(Float64, get(ENV, "RETESTITEMS_MEMORY_THRESHOLD", string(DEFAULT_MEMORY_THRESHOLD[]))),
202208
debug=0,
203209
name::Union{Regex,AbstractString,Nothing}=nothing,
204210
tags::Union{Symbol,AbstractVector{Symbol},Nothing}=nothing,

0 commit comments

Comments
 (0)