Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.01 KB

connect_to_node.livemd

File metadata and controls

46 lines (34 loc) · 1.01 KB

Connect to node - dashboard example

Mix.install([
  :kino_membrane
])

Dashboard

To be able to connect to a running node, it should be started in the distributed mode. For example, instead of

mix phx.server

type

elixir --sname sid --cookie monster -S mix phx.server

Then, you can connect to the node with the following code:

# If the node is not running locally, provide its hostname instead
{:ok, hostname} = :inet.gethostname()
node = :"sid@#{hostname}"
Node.set_cookie(node, :monster)
status = Node.connect(node)

if status == false do
  raise "Couldn't connect to the node #{inspect(node)}"
end

:ok

Now you can show a dashboard for a pipeline running on the node. The snippet below lists all the running pipelines and displays the dashboard for one of them.

case Membrane.Pipeline.list_pipelines(node) do
  [pipeline | _pipelines] -> KinoMembrane.pipeline_dashboard(pipeline)
  [] -> raise "No running pipelines found in the node #{inspect(node)}"
end