Open
Description
function init_eager()
EAGER_INIT[] && return
EAGER_INIT[] = true
ctx = eager_context()
@async try
sopts = SchedulerOptions(;allow_errors=true)
topts = ThunkOptions(;single=1)
Dagger.compute(ctx, Dagger.delayed(eager_thunk;options=topts)(); options=sopts)
catch err
iob = IOContext(IOBuffer(), :color=>true)
println(iob, "Error in eager scheduler:")
Base.showerror(iob, err)
Base.show_backtrace(iob, catch_backtrace())
println(iob)
seek(iob.io, 0)
write(stderr, iob)
finally
EAGER_INIT[] = false
end
end
This creates its own set of scheduler and thunk options.
function _spawn(f, args...; kwargs...)
Dagger.Sch.init_eager()
uid = eager_next_id()
future = ThunkFuture()
finalizer_ref = poolset(EagerThunkFinalizer(uid))
added_future = Future()
put!(Dagger.Sch.EAGER_THUNK_CHAN, (added_future, future, uid, finalizer_ref, f, (args...,), (kwargs...,)))
thunk_ref = fetch(added_future)
return (uid, future, finalizer_ref, thunk_ref)
end
and spawn
seems to not pass any of the kwargs
(where proclist
would presumably be) to init_eager
.