#signature of Exec does have ctx context

1 messages ยท Page 1 of 1 (latest)

quasi mesa
#

Also, though we use ctx in many calls, we don't use it in our Execs in the Getting Started, for example.

has ctx:

output, err := build.Directory(path).ID(ctx)
...
_, err = workdir.Write(ctx, output, dagger.HostDirectoryWriteOpts{Path: path})

vs

no ctx:

build = build.Exec(dagger.ContainerExecOpts{
          Args: []string{"go", "build", "-o", path},
        })
naive iron
#

yeah sorry I should have been more clear with "it shouldn't" ๐Ÿ˜‚ The Exec function doesn't take a context, are you seeing some documentation where it does?

naive iron
quasi mesa
#

ah, right! I'm wondering if he thought it took a context because he looked at wrong spot too ๐Ÿ˜„

#

or just cuz so many other things do

naive iron
#

Maybe! Can we do a better job of emphasizing the pkg.go.dev docs?

quasi mesa
#

Dunno, I think I did a search in our repo for Exec and didn't even look that it was core vs sdk, lol. I was like, nice! found it!

#

It also aligned with the confusion/issue he was having, so I was like, "aha!"

naive iron
quasi mesa
#

d'oh, of course it is. I still wonder about the ctx vs no -ctx items. I guess we're looking to make IDs not required, so that ctx goes away...trying to wrap my head around which Context a user should be in charge of when it comes to the Dagger pipeline bit, if any.

naive iron
#

It can definitely be confusing when you're first putting things together, especially if you're not aware of the underlying graphql api. I think of it as anything that actually causes an execution needs a context and returns an error (although apparently that's not always true ๐Ÿ˜‚ )

quasi mesa
#

"anything that actually causes an execution" except an Exec? ๐Ÿคฃ

#

or you mean execution in the go program?

naive iron
#

Haha well technically ๐Ÿค“ exec doesn't cause an execution, it just adds a command to the statement you're preparing. I mean execution as in something actually gets sent to the dagger engine

#

that's where the confusion lies I think, between "pipeline building" vs "graphql query building"

quasi mesa
#

this timestamp for confusion โ˜๏ธ @spark sparrow

naive iron
quasi mesa
spark sparrow
#

Maybe it should be called Command rather than Exec ... /cc @elfin apex

#

but basically at that point you're still constructing the DAG, not actually executing anything