Repository navigation
Closed
Labels
area/documentationImprovements or additions to documentation
Description
Related #3555
There's been confusion over the "lazy" model, what is sync vs what is async (few discord threads, feedback forum, live YouTube video, ...)
Not only it's confusing, it's one of great advantages of dagger and it's not being understood: write "procedural" code (e.g. container1.Exec, container1.Exec, anotherGraph.mount(container1, container2) and have everything run in parallel, as fast as possible)
I think we should:
- Document in the getting started (it's a major feature, not a "problem")
- Examples should show the parallelization mechanism
- Embrace the fact that things get lazily executed with maximum parallelism
- Make it less confusing in the API
- Go SDK: Pass objects by reference instead of ID #3598 helps with that
- Enforce a standard (if it returns an error, it's synchronous)
- Mostly the case except for
ID()-- consider makingIDsynchronous - Consider hiding the need for IDs in codegen clients #3558 (comment)
- Mostly the case except for
- Add an explicit "synchronous" function (e.g.
container.Exec().Sync())- Right now we're forced to call a "dummy" synchronous function (e.g.
Stdout().Contents()) and throw away the result to force something to be executed
- Right now we're forced to call a "dummy" synchronous function (e.g.
- Maybe: Force evaluation of "unsolved" nodes at
.Close()time?- For instance:
c.Container().From("alpine").Exec("echo", "hello world")will never be executed as it's not referenced anywhere - Perhaps query builder should track "pending" queries and "flush" them on
client.Close()? - I've seen this happening on the YT video
- call "go build", nothing happens, script returns immediately. Let's check Stdout(). Oh it's working now 🤔
- For instance:
Reacted by Thinking Errol and ashley-b
Metadata
Metadata
Assignees
Labels
area/documentationImprovements or additions to documentation
Activity
shykes commentedon Oct 31, 2022
I agree this is a high-priority DX item. So a general 👍to spending time on all this now.
Embrace the laziness
+1 it's a strength of our compute model. We should embrace it and educate people upfront about it. Of course that is work :)
Handling of IDs
This one feels like a special case, I would like to discuss it a bit more before we cross any one-way doors.
My feeling so far:
Developers seem to find the ID handling part of our Go API confusing
Hiding it is probably a good idea, because from the Go point of view, it's an implementation detail related to the limitations of the underlying query language (graphql). My attempt at explaining this to @nicholasjackson:
Even hidden, IDs need to have a clear purpose that we can explain. Given the above, I feel like maybe we should change the name from ID to something else. The name is rooted in the GraphQL best practice of giving every object its own ID. But we have slowly deviated from that best practice, both in implementation (content-addressed, no DB lookup) and in intent (domain-specific save/load of pipeline state). So I think we should at least consider looking for alternatives that are less confusing.
dolanor commentedon Nov 2, 2022
@slumbering was also thinking that for the TS SDK, where you can start typing functions, but if you just stop there, you're actually running nothing.
I was thinking about maybe some linter that would analyze that and underline some code that would execute nothing.
But I agree with the fact that this way of lazy evaluation is a strength and we should document it more no matter what we decide to do on the other hand.
jpadams commentedon Jan 13, 2023
helderco commentedon Apr 24, 2023
@vikram-dagger, we need to move this forward. Can you help?
Updated description of the problem in:
For the last "Maybe: Force evaluation of "unsolved" nodes at .Close() time?" I have a separate proposal:
helderco commentedon Jul 18, 2023
Update: Need to update the description here. It's currently outdated but it's still much needed.