From e4efe5671c3a18ef8a1a373c38817313c943c465 Mon Sep 17 00:00:00 2001 From: DrChainsaw Date: Mon, 5 Oct 2020 22:35:17 +0200 Subject: [PATCH] Check for available procs list in function --- src/scheduler.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scheduler.jl b/src/scheduler.jl index 000112d4..8f602465 100644 --- a/src/scheduler.jl +++ b/src/scheduler.jl @@ -116,8 +116,7 @@ function compute_dag(ctx, d::Thunk; options=SchedulerOptions()) continue end - @assert !isempty(procs_to_use(ctx)) "No workers available available!!" - + check_integrity(ctx) # Check periodically for new workers in a parallel task so that we don't accidentally end up # having to wait for 'take!(chan)' on some large task before new workers are put to work # Lock is used to stop this task as soon as something pops out from the channel to minimize @@ -174,6 +173,9 @@ function procs_to_use(ctx, options) end end +check_integrity(ctx) = check_integrity(ctx, ctx.options) +check_integrity(ctx, ::Any) = @assert !isempty(procs_to_use(ctx)) "No workers available!!" + # Main responsibility of this function is to check if new procs have been pushed to the context function assign_new_procs!(ctx, state, chan, node_order, assignedprocs=[]) ps = procs_to_use(ctx)