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

Use async states #390

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Use async states #390

wants to merge 4 commits into from

Conversation

cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Oct 8, 2024

Make use of async states to help prevent unlazying builds until we are ready to solve things.
See individual commits for more details.

This allows us to put merges under a progress group and is purely
cosmetic.

Signed-off-by: Brian Goff <[email protected]>
This wraps the signer in an async state so it can be lazily evaluated
regardless of if the actual signer needs to unlazy the build.

Signed-off-by: Brian Goff <[email protected]>
Before this was returning early when there are file-based errors,
however it is still helpful to run the rest of the tests so we can see
all errors in one go.

Signed-off-by: Brian Goff <[email protected]>
This generally cleans up some things in the test runner a little bit and
makes it so more checks are run in parallel and mostly avoids needing to
unlazy the build while we are processing the spec.
It also does a better job of collecting and returning errors related to
failed tests rather than returning just a single error immediately on a
single test failure.

Before this change the for loops may block to solve states and prevent
progress from happening.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83 cpuguy83 requested a review from a team as a code owner October 8, 2024 18:29
Copy link
Contributor

@pmengelbert pmengelbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuguy83

This needs a rebase -- I'll give it a proper review once that's done.

@@ -247,6 +247,14 @@ func getSignConfigCtxName(client gwclient.Client) string {

type asyncStateFunc func(context.Context, llb.State, *llb.Constraints) (llb.State, error)

func withConstraints(in *llb.Constraints) dalec.ConstraintsOptFunc {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's now a project-wide solution for this, dalec.WithConstraints

for k, st := range inputs {
def, err := st.Marshal(ctx, withConstraints)
def, err := st.Marshal(ctx, withConstraints(constraints))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

if err != nil {
return llb.Scratch(), err
}
m[k] = def.ToPB()
}
req.FrontendInputs = m

stateDef, err := st.Marshal(ctx, withConstraints)
stateDef, err := st.Marshal(ctx, withConstraints(constraints))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

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

Successfully merging this pull request may close these issues.

2 participants