Skip to content

Commit

Permalink
Malt tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Sep 18, 2023
1 parent cc706f5 commit a7908dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/evaluation/WorkspaceManager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ function unmake_workspace(session_notebook::SN; async::Bool=false, verbose::Bool
nothing
end

function workspace_exception_result(ex::Base.IOError, workspace::Workspace)
function workspace_exception_result(ex::Union{Base.IOError, Malt.TerminatedWorkerException, Distributed.ProcessExitedException}, workspace::Workspace)
(
output_formatted=PlutoRunner.format_output(CapturedException(ex, [])),
errored=true,
Expand All @@ -364,9 +364,9 @@ function workspace_exception_result(ex::Base.IOError, workspace::Workspace)
)
end

function workspace_exception_result(exs::CompositeException, workspace::Workspace)
ex = first(exs.exceptions)
workspace_exception_result(exs::CompositeException, workspace::Workspace) = workspace_exception_result(first(exs.exceptions), workspace)

function workspace_exception_result(ex::Exception, workspace::Workspace)
if ex isa InterruptException || (ex isa Malt.RemoteException && occursin("InterruptException", ex.message))
@info "Found an interrupt!" ex
(
Expand All @@ -378,23 +378,13 @@ function workspace_exception_result(exs::CompositeException, workspace::Workspac
published_objects=Dict{String,Any}(),
has_pluto_hook_features=false,
)
elseif ex isa Malt.TerminatedWorkerException
(
output_formatted=PlutoRunner.format_output(CapturedException(exs, [])),
errored=true,
interrupted=true,
process_exited=true && !workspace.discarded, # don't report a process exit if the workspace was discarded on purpose
runtime=nothing,
published_objects=Dict{String,Any}(),
has_pluto_hook_features=false,
)
else
@error "Unkown error during eval_format_fetch_in_workspace" ex
(
output_formatted=PlutoRunner.format_output(CapturedException(exs, [])),
output_formatted=PlutoRunner.format_output(CapturedException(ex, [])),
errored=true,
interrupted=true,
process_exited=false,
process_exited=!Malt.isrunning(workspace.worker) && !workspace.discarded, # don't report a process exit if the workspace was discarded on purpose
runtime=nothing,
published_objects=Dict{String,Any}(),
has_pluto_hook_features=false,
Expand Down
3 changes: 3 additions & 0 deletions src/runner/PlutoRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,9 @@ function with_io_to_logs(f::Function; enabled::Bool=true, loglevel::Logging.LogL
_send_stdio_output!(output, loglevel)
catch err
@error "Failed to redirect stdout/stderr to logs" exception=(err,catch_backtrace())
if err isa InterruptException
rethrow(err)
end
end
end

Expand Down

0 comments on commit a7908dd

Please sign in to comment.