mbklein

mbklein

I’ve been playing with the Remote Execution smart cell, and it’s been mostly fantastic. Just about everything I was looking for when I made this offhand comment back in May. :slight_smile:

I’m left with two major questions:

  1. I’m working on creating a LiveBook that will be mostly focused on interacting with one specific application. I’d like to be able to set the node name and cookie somewhere (maybe in the setup; maybe in a regular cell) and have those become the values (or at least the defaults) used for each Remote Execution smart cell I add. I’d be happy to use secrets for them[1], but it looks like you can’t use a secret or variable for the node name. I suppose the alternative would be to create my own smart cell that uses my target runtime’s settings instead of allowing for user input.

  2. I’ve found that I get an error if the Elixir/OTP versions of the livebook environment and the remote are not exactly the same, down to the elixir point release (i.e., Livebook built on 1.15.2-otp-26 while my remote runtime is 1.15.4-otp-26). Is there a way around that, or is it just how it is? I don’t mind building a livebook container using the same base image as my app, but if there’s another way, I’d love to know it.

[1] Side question: Is it possible to programatically set a secret from a cell (or in the notebook setup) for use in another cell?

Showing Posts 1 to 10

josevalim

josevalim

Creator of Elixir

Can you please open up an issue? EDIT: Nevermind, I created an issue here. If you want to explore it and send a PR, it will be welcome: Improvements to remote execution cell · Issue #355 · livebook-dev/kino · GitHub

Which error do you get? :slight_smile:

Secrets are env vars, so try setting or overriding “LB_SECRET_NAME”, and let us know how it goes.

jonatanklosko

jonatanklosko

Creator of Livebook

@mbklein what OTP versions are you using on remote and locally?

mbklein

mbklein OP

Will do, thanks.

Wow, I even had the error on my clipboard ready to go, and completely failed to hit paste.

My test remote runtime’s startup log looks like this:

Erlang/OTP 26 [erts-14.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.6) - press Ctrl+C to exit (type h() ENTER for help)

Then I run this in a livebook cell:

{:local, System.version(), :erlang.system_info(:otp_release)} |> IO.inspect()
Node.set_cookie(runtime_node, runtime_cookie)
:erpc.call(runtime_node, fn -> {:remote, System.version(), :erlang.system_info(:otp_release)} end)

Output:

{:local, "1.15.2", ~c"26"}
** (ErlangError) Erlang error: {:exception, {:badfun, #Function<43.125776118/0 in :erl_eval.expr/6>}, [{:erlang, :apply, 2, []}]}
    (kernel 9.0.2) erpc.erl:702: :erpc.call/5
    #cell:k7nkn7u5tzfc2lpqmpli5dnwbtu2zmg5:3: (file)

I get the same result if I change the remote function to fn -> :ok end, so clearly it’s not the code. Both functions work fine if the livebook node and the remote runtime node are on matching versions.

Secrets are env vars, so try setting or overriding “LB_SECRET_NAME”, and let us know how it goes.

I tried setting the env var in the notebook setup, and it didn’t create a secret that I could browse and select in the remote execution cell’s cookie field. But maybe it would work if I create the cookie beforehand and then change its value in code. I’ll play around with it and get back to you.

josevalim

josevalim

Creator of Elixir

I see. So you need to create a secret, choose it, and then you can replace its value dynamically inside the runtime using System.put_env/2.

mbklein

mbklein OP

OTP 26 on both. The only difference when I get the error is the Elixir patch version.

codyjroberts

codyjroberts

@josevalim @jonatanklosko super excited to see the remote smart cell. But I’ve been having some issues.

I saw your PRs and reddit post around the fix for :eprc.call(node, fn -> :ok end) failing on differing OTP/elixir versions, yet I’m seeing the same issue on latest with and without the smart cell. I can’t for the life of me find any documentation around how to get OTP minor/patch versions from the repl though.

Error:

** (ErlangError) Erlang error: {:exception, {:badfun, #Function<43.105768164/0 in :erl_eval.expr/6>}, [{:erlang, :apply, 2, []}]}
    (kernel 9.1) erpc.erl:702: :erpc.call/5

Remote node, local livebook (connected via wireguard), and fly notebook all show

%{
  version: "1.15.7",
  date: "2023-10-14T10:23:03Z",
  otp_release: "26",
  build: "1.15.7 (compiled with Erlang/OTP 26)",
  revision: "927b10d"
}

and Livebook v0.11.3 (also tried v0.11.2)

:erpc.call works fine w/ MFA. I’m stumped on how to debug this further and I’m probably doing something silly so figured I’d post here rather than open an issue. Any ideas?

josevalim

josevalim

Creator of Elixir

You need both nodes on 1.15.7+, which means it requires the same version for now but not for future versions.

codyjroberts

codyjroberts

Thanks for the reply and sorry for the confusion.

What I’m saying is that the nodes are on 1.15.7. They all return the same value from System.build_info().

josevalim

josevalim

Creator of Elixir

Can you call :erpc.call(node, :elixir, :module_info, []) on both nodes and let me know what it returns? Is the vsn attribute the same? Are the OTP versions exactly the same too?

EDIT: Nevermind, I know what is wrong. The fix we provided for Elixir is not enough.

josevalim

josevalim

Creator of Elixir

Can you folks please try Kino’s main? GitHub - livebook-dev/kino: Client-driven interactive widgets for Livebook · GitHub We have pushed a new approach that should work and be more robust across both Erlang and Elixir version changes.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
Stef-Verniers
Hello I’ve been coding in Elixir for almost two years now because of my current job where we implemented Elixir in our application. But ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews