benchee icon indicating copy to clipboard operation
benchee copied to clipboard

Benchee throws an exception when running in the Livebook-App

Open NickNeck opened this issue 2 years ago • 2 comments

Hello

Benchee runs great in Livebook, but raises an exception in the Livebook-App.

In the Livebook-App the file Path.join([:code.root_dir(), "releases", otp_release, "OTP_VERSION"]) is not available.

Maybe Benchee.System.erlang/0 could return otp_release as a fallback.

NickNeck avatar Aug 03 '22 08:08 NickNeck

Huh, thanks for the report. Guess I have to get playing with live book. Weird that it isn't there but yeah... that this is the way to get the OTP version is still very sad.

We can do that, we rely on the correct version for some switches in logic though (sadly). But well, better than crashing.

PragTob avatar Aug 04 '22 08:08 PragTob

@PragTob if you want to play with Livebook you can give benchee_dsl.livemd a try. I borrowed some lines from your readme for the notebook.

NickNeck avatar Aug 07 '22 16:08 NickNeck

A quick workaround to prevent the crash is:

otp_release = :erlang.system_info(:otp_release)
File.mkdir_p!(Path.join([:code.root_dir(), "releases", otp_release]))

Path.join([:code.root_dir(), "releases", otp_release, "OTP_VERSION"])
|> File.write!("25.0")

The OTP version of the most recent livebook app seems to be 25.0 link.

zorbash avatar Oct 03 '22 11:10 zorbash