Skip to content

Commit

Permalink
Start os_mon in standalone runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Aug 19, 2024
1 parent 5bfaf26 commit c8b0de1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/livebook/runtime/erl_dist/node_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ defmodule Livebook.Runtime.ErlDist.NodeManager do
* `:capture_orphan_logs` - whether to capture logs out of Livebook
evaluator's scope. Defaults to `true`
* `:start_os_mon` - starts `:os_mon` for additional statistics in
LiveDashboard. Defaults to `false`
"""
def start(opts \\ []) do
GenServer.start(__MODULE__, opts, name: @name)
Expand Down Expand Up @@ -96,6 +99,7 @@ defmodule Livebook.Runtime.ErlDist.NodeManager do
auto_termination = Keyword.get(opts, :auto_termination, true)
parent_node = Keyword.get(opts, :parent_node)
capture_orphan_logs = Keyword.get(opts, :capture_orphan_logs, true)
start_os_mon = Keyword.get(opts, :start_os_mon, false)

## Initialize the node

Expand Down Expand Up @@ -150,6 +154,10 @@ defmodule Livebook.Runtime.ErlDist.NodeManager do

:net_kernel.monitor_nodes(true, node_type: :all)

if start_os_mon do
Application.ensure_all_started(:os_mon)
end

{:ok,
%{
unload_modules_on_termination: unload_modules_on_termination,
Expand Down
1 change: 1 addition & 0 deletions lib/livebook/runtime/fly.ex
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ defmodule Livebook.Runtime.Fly do

defp initialize_node(child_node) do
init_opts = [
node_manager_opts: [start_os_mon: true],
runtime_server_opts: [
extra_smart_cell_definitions: Livebook.Runtime.Definitions.smart_cell_definitions()
]
Expand Down
1 change: 1 addition & 0 deletions lib/livebook/runtime/standalone.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ defmodule Livebook.Runtime.Standalone do

Utils.temporarily_register(self(), child_node, fn ->
init_opts = [
node_manager_opts: [start_os_mon: true],
runtime_server_opts: [
extra_smart_cell_definitions: Livebook.Runtime.Definitions.smart_cell_definitions()
]
Expand Down

0 comments on commit c8b0de1

Please sign in to comment.