@@ -9,7 +9,7 @@ import Random: randperm
99import Base: @invokelatest
1010
1111import .. Dagger
12- import .. Dagger: Context, Processor, Thunk, WeakThunk, ThunkFuture, ThunkFailedException, Chunk, WeakChunk, OSProc, AnyScope
12+ import .. Dagger: Context, Processor, Thunk, WeakThunk, ThunkFuture, ThunkFailedException, Chunk, WeakChunk, OSProc, AnyScope, DefaultScope
1313import .. Dagger: order, dependents, noffspring, istask, inputs, unwrap_weak_checked, affinity, tochunk, timespan_start, timespan_finish, procs, move, chunktype, processor, default_enabled, get_processors, get_parent, execute!, rmprocs!, addprocs!, thunk_processor, constrain, cputhreadtime
1414
1515const OneToMany = Dict{Thunk, Set{Thunk}}
@@ -143,13 +143,13 @@ end
143143Stores DAG-global options to be passed to the Dagger.Sch scheduler.
144144
145145# Arguments
146- - `single::Int=0`: Force all work onto worker with specified id. `0` disables
147- this option.
148- - `proclist=nothing`: Force scheduler to use one or more processors that are
149- instances/subtypes of a contained type. Alternatively, a function can be
150- supplied, and the function will be called with a processor as the sole
151- argument and should return a `Bool` result to indicate whether or not to use
152- the given processor. `nothing` enables all default processors.
146+ - `single::Int=0`: (Deprecated) Force all work onto worker with specified id.
147+ `0` disables this option.
148+ - `proclist=nothing`: (Deprecated) Force scheduler to use one or more
149+ processors that are instances/subtypes of a contained type. Alternatively, a
150+ function can be supplied, and the function will be called with a processor as
151+ the sole argument and should return a `Bool` result to indicate whether or not
152+ to use the given processor. `nothing` enables all default processors.
153153- `allow_errors::Bool=true`: Allow thunks to error without affecting
154154non-dependent thunks.
155155- `checkpoint=nothing`: If not `nothing`, uses the provided function to save
@@ -176,11 +176,11 @@ end
176176Stores Thunk-local options to be passed to the Dagger.Sch scheduler.
177177
178178# Arguments
179- - `single::Int=0`: Force thunk onto worker with specified id. `0` disables this
180- option.
181- - `proclist=nothing`: Force thunk to use one or more processors that are
182- instances/subtypes of a contained type. Alternatively, a function can be
183- supplied, and the function will be called with a processor as the sole
179+ - `single::Int=0`: (Deprecated) Force thunk onto worker with specified id. `0`
180+ disables this option.
181+ - `proclist=nothing`: (Deprecated) Force thunk to use one or more processors
182+ that are instances/subtypes of a contained type. Alternatively, a function can
183+ be supplied, and the function will be called with a processor as the sole
184184argument and should return a `Bool` result to indicate whether or not to use
185185the given processor. `nothing` enables all default processors.
186186- `time_util::Dict{Type,Any}=Dict{Type,Any}()`: Indicates the maximum expected
@@ -634,7 +634,12 @@ function schedule!(ctx, state, procs=procs_to_use(ctx))
634634 scope = if task. f isa Chunk
635635 task. f. scope
636636 else
637- AnyScope ()
637+ if task. options. proclist != = nothing
638+ # proclist overrides scope selection
639+ AnyScope ()
640+ else
641+ DefaultScope ()
642+ end
638643 end
639644 for input in task. inputs
640645 input = unwrap_weak_checked (input)
@@ -682,7 +687,8 @@ function schedule!(ctx, state, procs=procs_to_use(ctx))
682687
683688 for proc in local_procs
684689 gproc = get_parent (proc)
685- if can_use_proc (task, gproc, proc, opts, scope)
690+ can_use, scope = can_use_proc (task, gproc, proc, opts, scope)
691+ if can_use
686692 has_cap, est_time_util, est_alloc_util = has_capacity (state, proc, gproc. pid, opts. time_util, opts. alloc_util, sig)
687693 if has_cap
688694 # Schedule task onto proc
@@ -693,7 +699,7 @@ function schedule!(ctx, state, procs=procs_to_use(ctx))
693699 end
694700 end
695701 end
696- state. cache[task] = SchedulingException (" No processors available, try making proclist more liberal " )
702+ state. cache[task] = SchedulingException (" No processors available, try widening scope " )
697703 state. errored[task] = true
698704 set_failed! (state, task)
699705 @goto pop_task
@@ -706,7 +712,8 @@ function schedule!(ctx, state, procs=procs_to_use(ctx))
706712 cap, extra_util = nothing , nothing
707713 procs_found = false
708714 # N.B. if we only have one processor, we need to select it now
709- if can_use_proc (task, entry. gproc, entry. proc, opts, scope)
715+ can_use, scope = can_use_proc (task, entry. gproc, entry. proc, opts, scope)
716+ if can_use
710717 has_cap, est_time_util, est_alloc_util = has_capacity (state, entry. proc, entry. gproc. pid, opts. time_util, opts. alloc_util, sig)
711718 if has_cap
712719 selected_entry = entry
@@ -723,14 +730,15 @@ function schedule!(ctx, state, procs=procs_to_use(ctx))
723730 if procs_found
724731 push! (failed_scheduling, task)
725732 else
726- state. cache[task] = SchedulingException (" No processors available, try making proclist more liberal " )
733+ state. cache[task] = SchedulingException (" No processors available, try widening scope " )
727734 state. errored[task] = true
728735 set_failed! (state, task)
729736 end
730737 @goto pop_task
731738 end
732739
733- if can_use_proc (task, entry. gproc, entry. proc, opts, scope)
740+ can_use, scope = can_use_proc (task, entry. gproc, entry. proc, opts, scope)
741+ if can_use
734742 has_cap, est_time_util, est_alloc_util = has_capacity (state, entry. proc, entry. gproc. pid, opts. time_util, opts. alloc_util, sig)
735743 if has_cap
736744 # Select this processor
0 commit comments