Skip to content

checkpoint: Use at-invokelatest #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2023
Merged
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
5 changes: 3 additions & 2 deletions src/sch/Sch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import MemPool: DRef, StorageResource
import MemPool: poolset, storage_available, storage_capacity, storage_utilized, externally_varying
import Statistics: mean
import Random: randperm
import Base: @invokelatest

import ..Dagger
import ..Dagger: Context, Processor, Thunk, WeakThunk, ThunkFuture, ThunkFailedException, Chunk, WeakChunk, OSProc, AnyScope
Expand Down Expand Up @@ -527,7 +528,7 @@ function scheduler_run(ctx, state::ComputeState, d::Thunk, options)
state.errored[node] = thunk_failed
if node.options !== nothing && node.options.checkpoint !== nothing
try
node.options.checkpoint(node, res)
@invokelatest node.options.checkpoint(node, res)
catch err
report_catch_error(err, "Thunk checkpoint failed")
end
Expand Down Expand Up @@ -892,7 +893,7 @@ function fire_tasks!(ctx, thunks::Vector{<:Tuple}, (gproc, proc), state)
end
if thunk.options !== nothing && thunk.options.restore !== nothing
try
result = thunk.options.restore(thunk)
result = @invokelatest thunk.options.restore(thunk)
if result isa Chunk
state.cache[thunk] = result
state.errored[thunk] = false
Expand Down