Skip to content

Sch: Don't overwrite error result #632

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/sch/Sch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ function scheduler_run(ctx, state::ComputeState, d::Thunk, options)
state.transfer_rate[] = (state.transfer_rate[] + metadata.transfer_rate) ÷ 2
end
end
if thunk_failed && res isa RemoteException
res = res.captured
end
@assert !haskey(state.cache, node)
state.cache[node] = res
state.errored[node] = thunk_failed
if node.options !== nothing && node.options.checkpoint !== nothing
Expand Down
25 changes: 19 additions & 6 deletions src/sch/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,29 @@ end

"Marks `thunk` and all dependent thunks as failed."
function set_failed!(state, origin, thunk=origin)
filter!(x->x!==thunk, state.ready)
ex = state.cache[origin]
if ex isa RemoteException
ex = ex.captured
@assert islocked(state.lock)

if haskey(state.cache, thunk)
@assert state.errored[thunk]
# We've already been called previously with this thunk
return
end

filter!(x -> x !== thunk, state.ready)
# N.B. If origin === thunk, we assume that the caller has already set the error
if origin !== thunk
origin_ex = state.cache[origin]
if origin_ex isa RemoteException
origin_ex = origin_ex.captured
end
state.cache[thunk] = DTaskFailedException(thunk, origin, origin_ex)
state.errored[thunk] = true
end
state.cache[thunk] = DTaskFailedException(thunk, origin, ex)
state.errored[thunk] = true
finish_failed!(state, thunk, origin)
end
function finish_failed!(state, thunk, origin=nothing)
@assert islocked(state.lock)
# FIXME: This is duplicative with finish_task!
fill_registered_futures!(state, thunk, true)
if haskey(state.waiting_data, thunk)
for dep in state.waiting_data[thunk]
Expand Down