#dagger run (dagger call; dagger call)
1 messages ยท Page 1 of 1 (latest)
Opening an issue never hurts; we can probably fix this, but more generally I think the jury's out on how/whether dagger run plays into Zenith, i.e. whether it gets retired/replaced. I definitely never thought to wrap dagger call in it ๐
it's not about dagger run per se, but more about the same session thing. In our example module we have Service which uses dagger-in-dagger to call dagger functions on-demand upon receiving an event.
What's happening is that if the same module gets invoked twice, we get that error
ohhh could this be about nesting dagger sessions?
yes, exactly
well.. nesting I think it's another condition where this observed. I think the generic way of defining this is "dagger call can't be invoked multiple times within the same session"
which in the nesting case, happens to be the same
I'd assume the same thing happens also if you do a dagger listen and issue dagger call against the same session.
my guess is this happens specifically with the CLI because it works by calling Module.serve which mutates the current session
You mean dagger call? That just builds a query and executes it, it doesn't invoke functions directly anymore.
it's any command that uses -m afaik: https://github.com/dagger/dagger/blob/c716a042f290b11c6122d247f8b31651adb5f1d0/cmd/dagger/module.go#L481
calling .Serve() is how it's able to execute the query, since that's what installs the schema
Oh, right. ๐
Generally speaking if you want something to run in the same session, you can put it in a function. So if you have a top-level function that invokes Hello.message twice, then both invocations would be in the same session when that top-level function is invoked.
Is that viable for what you're trying with the webhook?
We are doing something a bit "funky". We are running a service using dagger up. This service creates a container with a Go server that itself uses the Dagger SDK (via dagger.Connect, the container is started with nesting enabled) to create a service that requests are proxied to. Based on what I understood, dagger.Connect is creating a new session within an existing session started by dagger up.
I'll test running only the main.go and see if that creates any problem. It shouldn't
I don't think so since what we're basically doing is starting a web server with nesting enabled that allows users to call dagger call on-demand whatever module they want. So those dagger calls will all be using the same dagger session (started by the web server). ๐ฌ