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""" - + """ end - defp render_output({:error, formatted, _type}, %{}) do - render_error(formatted) - end - # TODO: remove on Livebook v0.7 defp render_output(output, %{}) when elem(output, 0) in [ @@ -143,14 +118,6 @@ defmodule LivebookWeb.Output do """) end - defp render_error(message) do - assigns = %{message: message} - - ~H""" - - """ - end - defp render_error_message(message) do assigns = %{message: message} diff --git a/lib/livebook_web/live/output/frame_component.ex b/lib/livebook_web/live/output/frame_component.ex index 806dbb098..1fcefc974 100644 --- a/lib/livebook_web/live/output/frame_component.ex +++ b/lib/livebook_web/live/output/frame_component.ex @@ -84,9 +84,7 @@ defmodule LivebookWeb.Output.FrameComponent do dom_id_map={@persistent_id_map} socket={@socket} session_id={@session_id} - input_values={@input_values} - runtime={nil} - cell_validity={nil} /> + input_values={@input_values} /> <% end %> diff --git a/lib/livebook_web/live/session_live/cell_component.ex b/lib/livebook_web/live/session_live/cell_component.ex index 8d598be15..111693939 100644 --- a/lib/livebook_web/live/session_live/cell_component.ex +++ b/lib/livebook_web/live/session_live/cell_component.ex @@ -88,8 +88,7 @@ defmodule LivebookWeb.SessionLive.CellComponent do <.evaluation_outputs cell_view={@cell_view} socket={@socket} - session_id={@session_id} - runtime={@runtime} /> + session_id={@session_id} /> """ end @@ -133,8 +132,7 @@ defmodule LivebookWeb.SessionLive.CellComponent do <.evaluation_outputs cell_view={@cell_view} socket={@socket} - session_id={@session_id} - runtime={@runtime} /> + session_id={@session_id} /> """ @@ -213,8 +211,7 @@ defmodule LivebookWeb.SessionLive.CellComponent do <.evaluation_outputs cell_view={@cell_view} socket={@socket} - session_id={@session_id} - runtime={@runtime} /> + session_id={@session_id} /> """ end @@ -514,8 +511,6 @@ defmodule LivebookWeb.SessionLive.CellComponent do dom_id_map={%{}} socket={@socket} session_id={@session_id} - runtime={@runtime} - cell_validity={@cell_view.eval.validity} input_values={@cell_view.eval.input_values} /> """ diff --git a/test/livebook/runtime/evaluator/default_formatter_test.exs b/test/livebook/runtime/evaluator/default_formatter_test.exs index 98ebc09b0..3bf84c4dc 100644 --- a/test/livebook/runtime/evaluator/default_formatter_test.exs +++ b/test/livebook/runtime/evaluator/default_formatter_test.exs @@ -10,7 +10,7 @@ defmodule Livebook.Runtime.Evaluator.DefaultFormatterTest do test "gracefully handles errors in the inspect protocol" do result = %Livebook.TestModules.BadInspect{} - assert {:error, error, :other} = DefaultFormatter.format_result({:ok, result}) + assert {:error, error} = DefaultFormatter.format_result({:ok, result}) assert error =~ ":bad_return" end end diff --git a/test/support/noop_runtime.ex b/test/support/noop_runtime.ex index b5aadae61..c95d1c295 100644 --- a/test/support/noop_runtime.ex +++ b/test/support/noop_runtime.ex @@ -26,7 +26,6 @@ defmodule Livebook.Runtime.NoopRuntime do def drop_container(_, _), do: :ok def handle_intellisense(_, _, _, _), do: make_ref() - def standalone?(_), do: false def read_file(_, _), do: raise("not implemented") def start_smart_cell(_, _, _, _, _), do: :ok def set_smart_cell_base_locator(_, _, _), do: :ok