Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ParallelTestRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ function init_time(rec::AbstractTestRecord)
return base.total_time - base.time
end

# the user is warned once a warm worker's init time exceeds this multiple of the cold-start cost
# the user is warned once a warm worker's init time exceeds this multiple of the cold-start cost...
const SLOW_INIT_FACTOR = 2
# ... but only if it also exceeds this many seconds, to avoid false positives in test suites
# with a short cold worker init
const SLOW_INIT_MIN_TIME = 10.0

function Base.getindex(rec::AbstractTestRecord)
return parent(rec).value
Expand Down Expand Up @@ -1574,7 +1577,8 @@ function _runtests(mod::Module, args::ParsedArgs;
# the pre-test full GC has become much slower than spawning a
# new worker, which typically means there are too many workers
# for the available memory (e.g. macOS memory pressure, #124)
slow_init = wrkr === p && !fresh_worker && init_time(result) > SLOW_INIT_FACTOR * cold_init_time[]
slow_init = wrkr === p && !fresh_worker &&
init_time(result) > max(SLOW_INIT_FACTOR * cold_init_time[], SLOW_INIT_MIN_TIME)
# recycle a pool worker so future tests start with a smaller working
# set, or so that a failing test that may have left the worker in a
# bad state (e.g. a wedged GPU driver) cannot poison later tests
Expand Down
3 changes: 2 additions & 1 deletion test/workers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ end
end

# every test after the first on the worker is slow to init
slow_init = ceil(Int, 1.5 * ParallelTestRunner.SLOW_INIT_FACTOR * cold_init_time[]) + 1
slow_init = ceil(Int, max(1.5 * ParallelTestRunner.SLOW_INIT_FACTOR * cold_init_time[],
ParallelTestRunner.SLOW_INIT_MIN_TIME)) + 1
init_code = quote
Main.slow_init_counter[] += 1
Main.slow_init_counter[] > 1 && sleep($slow_init)
Expand Down
Loading