diff --git a/lib/livebook/runtime.ex b/lib/livebook/runtime.ex index f9369bf2f..5ef2044cf 100644 --- a/lib/livebook/runtime.ex +++ b/lib/livebook/runtime.ex @@ -57,7 +57,7 @@ defprotocol Livebook.Runtime do # A control element | {:control, attrs :: map()} # Internal output format for errors - | {:error, message :: binary(), type :: :other | :runtime_restart_required} + | {:error, message :: binary()} @typedoc """ Additional information about a complted evaluation. @@ -373,16 +373,6 @@ defprotocol Livebook.Runtime do @spec handle_intellisense(t(), pid(), intellisense_request(), locator()) :: reference() def handle_intellisense(runtime, send_to, request, base_locator) - @doc """ - Returns true if the given runtime is self-contained. - - A standalone runtime always starts fresh and frees all resources - on termination. This may not be the case for for runtimes that - connect to an external running system and use it for code evaluation. - """ - @spec standalone?(Runtime.t()) :: boolean() - def standalone?(runtime) - @doc """ Reads file at the given absolute path within the runtime file system. """ diff --git a/lib/livebook/runtime/attached.ex b/lib/livebook/runtime/attached.ex index 4b55020f3..46d164ea8 100644 --- a/lib/livebook/runtime/attached.ex +++ b/lib/livebook/runtime/attached.ex @@ -98,8 +98,6 @@ defimpl Livebook.Runtime, for: Livebook.Runtime.Attached do RuntimeServer.handle_intellisense(runtime.server_pid, send_to, request, base_locator) end - def standalone?(_runtime), do: false - def read_file(runtime, path) do RuntimeServer.read_file(runtime.server_pid, path) end diff --git a/lib/livebook/runtime/elixir_standalone.ex b/lib/livebook/runtime/elixir_standalone.ex index 1b7aa9785..eaea289ca 100644 --- a/lib/livebook/runtime/elixir_standalone.ex +++ b/lib/livebook/runtime/elixir_standalone.ex @@ -145,8 +145,6 @@ defimpl Livebook.Runtime, for: Livebook.Runtime.ElixirStandalone do RuntimeServer.handle_intellisense(runtime.server_pid, send_to, request, base_locator) end - def standalone?(_runtime), do: true - def read_file(runtime, path) do RuntimeServer.read_file(runtime.server_pid, path) end diff --git a/lib/livebook/runtime/embedded.ex b/lib/livebook/runtime/embedded.ex index 4cbe7804f..141b2d47a 100644 --- a/lib/livebook/runtime/embedded.ex +++ b/lib/livebook/runtime/embedded.ex @@ -92,8 +92,6 @@ defimpl Livebook.Runtime, for: Livebook.Runtime.Embedded do RuntimeServer.handle_intellisense(runtime.server_pid, send_to, request, base_locator) end - def standalone?(_runtime), do: false - def read_file(runtime, path) do RuntimeServer.read_file(runtime.server_pid, path) end diff --git a/lib/livebook/runtime/evaluator/default_formatter.ex b/lib/livebook/runtime/evaluator/default_formatter.ex index 56997c5fb..9978b9e42 100644 --- a/lib/livebook/runtime/evaluator/default_formatter.ex +++ b/lib/livebook/runtime/evaluator/default_formatter.ex @@ -27,7 +27,7 @@ defmodule Livebook.Runtime.Evaluator.DefaultFormatter do def format_result({:error, kind, error, stacktrace}) do formatted = format_error(kind, error, stacktrace) - {:error, formatted, error_type(error)} + {:error, formatted} end @compile {:no_warn_undefined, {Kino.Render, :to_livebook, 1}} @@ -57,7 +57,7 @@ defmodule Livebook.Runtime.Evaluator.DefaultFormatter do catch kind, error -> formatted = format_error(kind, error, __STACKTRACE__) - {:error, formatted, :other} + {:error, formatted} end end @@ -86,19 +86,6 @@ defmodule Livebook.Runtime.Evaluator.DefaultFormatter do ] end - defp error_type(error) do - cond do - mix_install_vm_error?(error) -> :runtime_restart_required - true -> :other - end - end - - defp mix_install_vm_error?(exception) do - is_struct(exception, Mix.Error) and - Exception.message(exception) =~ - "Mix.install/2 can only be called with the same dependencies" - end - defp format_error(kind, error, stacktrace) do {blamed, stacktrace} = Exception.blame(kind, error, stacktrace) diff --git a/lib/livebook/runtime/mix_standalone.ex b/lib/livebook/runtime/mix_standalone.ex index 77045227b..83a5b77cb 100644 --- a/lib/livebook/runtime/mix_standalone.ex +++ b/lib/livebook/runtime/mix_standalone.ex @@ -185,8 +185,6 @@ defimpl Livebook.Runtime, for: Livebook.Runtime.MixStandalone do RuntimeServer.handle_intellisense(runtime.server_pid, send_to, request, base_locator) end - def standalone?(_runtime), do: true - def read_file(runtime, path) do RuntimeServer.read_file(runtime.server_pid, path) end diff --git a/lib/livebook_web/live/output.ex b/lib/livebook_web/live/output.ex index b17fe7576..7af388f6c 100644 --- a/lib/livebook_web/live/output.ex +++ b/lib/livebook_web/live/output.ex @@ -19,8 +19,6 @@ defmodule LivebookWeb.Output do id: "output-#{idx}", socket: @socket, session_id: @session_id, - runtime: @runtime, - cell_validity: @cell_validity, input_values: @input_values }) %> @@ -91,37 +89,14 @@ defmodule LivebookWeb.Output do live_component(Output.ControlComponent, id: id, attrs: attrs, input_values: input_values) end - defp render_output({:error, formatted, :runtime_restart_required}, %{ - runtime: runtime, - cell_validity: cell_validity - }) - when runtime != nil and cell_validity == :evaluated do - assigns = %{formatted: formatted, is_standalone: Livebook.Runtime.standalone?(runtime)} + defp render_output({:error, formatted}, %{}) do + assigns = %{message: formatted} ~H""" -