Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Dagger @spawn can't launch workers from Pluto

Open Oblynx opened this issue 3 years ago • 5 comments

Hi! I try to use Dagger.jl inside a Pluto cell. However, it can't seem to spawn even 1 worker when used from Pluto, while the same code runs with plain Julia.

Here's the Pluto notebook: https://gist.github.com/Oblynx/a0846ac1d1d021b52d52fa675c48aaa1

Here's the error message in Pluto:

On worker 1:

KeyError: key Dagger [d58978e5-989f-55fb-8d15-ea34adc7bf54] not found

2021-12-28_22:49:09

Oblynx avatar Dec 28 '21 22:12 Oblynx

This is related to #300, and unfortunately it is not trivial to fix soon!

pankgeorg avatar Dec 29 '21 20:12 pankgeorg

Oh this is indeed unfortunate! I wonder why Distributed can't nest.

Oblynx avatar Dec 30 '21 00:12 Oblynx

Pluto server runs on process 1 and the notebooks get a worker number. In general, apps that use Distributed assume they are process 1 and their children are processes 2:N. When you run from pluto, both assumptions break, as Distributed only has one nesting level.

pankgeorg avatar Dec 30 '21 08:12 pankgeorg

It seems that Dagger is trying to spawn the task from process id 1, so you can @spawn if you also import Dagger in the process where you launch Pluto from:

using Pluto, Dagger
Pluto.run()

I was then able to make your example work but note that there may be other issues down the line because of #300 as @pankgeorg said !

Pangoraw avatar Dec 31 '21 13:12 Pangoraw

This specific issue is solved, now that Pluto uses Malt rather than Distributed, Dagger can be loaded from the notebook.

Yet #300 is still an issue for Dagger as well as indicated above; UndefVarError: `workspace#3` not defined

ederag avatar Jun 04 '25 11:06 ederag

This is probably an issue with serialization... check out the other issues concerning serialization in Pluto

fonsp avatar Jun 24 '25 12:06 fonsp

Sure, https://github.com/fonsp/Pluto.jl/issues/1030 is relevant here too.

ederag avatar Jun 24 '25 17:06 ederag