mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-07 23:47:53 +08:00
79e5c432b3
* Isolate evaluation in separate node for each session * Start new remote upon first evaluation and handle nodedown * Add UI for managing evaluation node, improve naming and structure * Show runtime initialization errors and some fixes * Improve standalone node initialization * Correctly handle multiple sessions connecting to the same node * Fix session tests concerning evaluation * Documentation and some refactoring * Various improvements * Configure schedulers to get to sleep immediately after evaluation * Move EvaluatorSpervisor into the Remote namespace * Fix evaluators cleanup * Add tests * Improve flash messages * Introduce remote genserver taking care of cleanup * Redefine the Runtime protocol to serve as an interface for evaluation * Cleanup operations * Use reference for communication with a standalone node * Use shortnames for distribution by default * Update node configuration and make sure epmd is running * Rename Remote to ErlDist
42 lines
1.2 KiB
Elixir
42 lines
1.2 KiB
Elixir
defmodule LiveBook.Application do
|
|
# See https://hexdocs.pm/elixir/Application.html
|
|
# for more information on OTP Applications
|
|
@moduledoc false
|
|
|
|
use Application
|
|
|
|
def start(_type, _args) do
|
|
ensure_distribution()
|
|
|
|
children = [
|
|
# Start the Telemetry supervisor
|
|
LiveBookWeb.Telemetry,
|
|
# Start the PubSub system
|
|
{Phoenix.PubSub, name: LiveBook.PubSub},
|
|
# Start the supervisor dynamically managing sessions
|
|
LiveBook.SessionSupervisor,
|
|
# Start the Endpoint (http/https)
|
|
LiveBookWeb.Endpoint
|
|
]
|
|
|
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
|
# for other strategies and supported options
|
|
opts = [strategy: :one_for_one, name: LiveBook.Supervisor]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
# Tell Phoenix to update the endpoint configuration
|
|
# whenever the application is updated.
|
|
def config_change(changed, _new, removed) do
|
|
LiveBookWeb.Endpoint.config_change(changed, removed)
|
|
:ok
|
|
end
|
|
|
|
defp ensure_distribution() do
|
|
unless Node.alive?() do
|
|
System.cmd("epmd", ["-daemon"])
|
|
{type, name} = Application.fetch_env!(:live_book, :node_name)
|
|
Node.start(name, type)
|
|
end
|
|
end
|
|
end
|