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
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews