Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"workspaces" break serialization #1030

Open
aplavin opened this issue Mar 26, 2021 · 2 comments
Open

"workspaces" break serialization #1030

aplavin opened this issue Mar 26, 2021 · 2 comments

Comments

@aplavin
Copy link
Contributor

aplavin commented Mar 26, 2021

I'm trying to persist some structs between restarts of a notebook, but this doesn't work due to workspaceXXX being prepended to each module name.

A simple example follows.

  1. Create notebook with these four cells:
using Serialization

# for some reason M is actually named Main.workspace5.M in Pluto
# regular Julia REPL gives just Main.M
module M
struct S end
end

serialize("/tmp/s.ser", M.S())

deserialize("/tmp/s.ser")

Everything works fine here.
2. Remove the serialize(...) cell.
3. Restart the notebook.
4. The M module is now named Main.workspace13.M. Correspondingly, deserialize() fails with UndefVarError: workspace5 not defined error.

How to fix this error for now?

@aplavin aplavin changed the title "workspaces" and serialization "workspaces" break serialization Mar 26, 2021
@MichaelHatherly
Copy link
Contributor

@dralletje and I were discussing this one yesterday. It's a bit unfortunate that Serialization doesn't "just work" out of the box, but he did convince me it was necessary, so I've put together https://github.com/MichaelHatherly/PlutoSerialization.jl which handles finding the correct definitions within the workspaces during deserialization so that you can persist data between sessions in a more reproducible way. If it breaks or has any bugs please open an issue over in that repo.

@schlichtanders
Copy link

schlichtanders commented Oct 10, 2023

Now as Pluto supports the use of Distributed via Malt.jl, this issue appears again.

A simple remote call like

remotecall_fetch(() -> readchomp(`hostname`), pid) 

already gives the error like

UndefVarError: `workspace#72` not defined

I opened an issue on julialang/julia for this JuliaLang/Distributed.jl#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants