Skip to content

Commit 2f22449

Browse files
committed
Clean-up cached chunks on scheduler exit
1 parent 5a53b50 commit 2f22449

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/sch/Sch.jl

+9
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ function init_proc(state, p)
270270
state.worker_chans[p.pid] = (inp_chan, out_chan)
271271
end
272272
end
273+
function _cleanup_proc(uid)
274+
empty!(CHUNK_CACHE)
275+
end
276+
function cleanup_proc(state, p)
277+
remote_do(_cleanup_proc, p.pid, state.uid)
278+
end
273279

274280
"Process-local count of actively-executing Dagger tasks per processor type."
275281
const ACTIVE_TASKS = Dict{UInt64,Dict{Type,Ref{Float64}}}()
@@ -409,6 +415,9 @@ function compute_dag(ctx, d::Thunk; options=SchedulerOptions())
409415

410416
safepoint(state)
411417
end
418+
@sync for p in procs_to_use(ctx)
419+
@async cleanup_proc(state, p)
420+
end
412421
value = state.cache[d] # TODO: move(OSProc(), state.cache[d])
413422
if d in state.errored
414423
throw(value)

0 commit comments

Comments
 (0)