Remote Execution SmartCell questions

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?

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.

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

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), fn -> {:remote, System.version(), :erlang.system_info(:otp_release)} end)


{: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:
    #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.

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.

1 Like

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

@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, 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.


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

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) 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?

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


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().

Can you call, :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.

1 Like

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


Works great. Thanks much!