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

Make use of the controller-provided dynamic component dependencies #463

Closed
wants to merge 2 commits into from

Conversation

brandonbloom
Copy link
Member

This is a follow-up to #436 and is in service of #426.

@brandonbloom
Copy link
Member Author

This needs a fair amount of testing & it is very janky. However, I'm trying to land this janky change, since it unblocks #426, which is badly hurting the UX of the main migration path to exo.hcl files. Assuming this PR does that it's supposed to do, then at least the files on disk won't be crufted up with bad dependency information. Then I'm basically going to totally rework the component system internals in order to fix a variety of bugs. I think I know how to go about that now.

Spec: c.Spec,
})
if err != nil {
ws.logEventf(ctx, "error getting %q deps: %v", c.Name, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this considered a fatal error?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add a comment. I think that if it were a fatal error, then it would be impossible to stop components that have broken provider implementations or partially invalid specs that fail dependency analysis.

@@ -599,6 +647,7 @@ func (ws *Workspace) RenameComponent(ctx context.Context, input *api.RenameCompo

func (ws *Workspace) RefreshComponents(ctx context.Context, input *api.RefreshComponentsInput) (*api.RefreshComponentsOutput, error) {
query := makeComponentQuery(withRefs(input.Refs...))
// TODO: Recompute dependencies on refresh.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not quite clear why. Is this because we ignore a failure to get dependencies on apply?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll expand the comment. The main reason is because the analysis for dependencies in theory may be out of date, either because the provider implementation changed or because it depends on some non-deterministic data (none do currently), so the idea is that "refresh" should fixup and busted state as best it can.

@@ -154,29 +153,6 @@ func (c *Component) Analyze(ctx *AnalysisContext) {
} else {
c.Spec, _ = AnalyzeString(ctx, specAttr.Expr)
}

depsAttr := content.Attributes["depends_on"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we still need this? How otherwise does a user explicitly define a dependency? How would this docker compose file work?

services:
  t0:
    image: bash
    command: "sleep infinity"
  t1:
    image: bash
    command: "sleep infinity"
    depends_on:
      - "t0"

Copy link
Member Author

Choose a reason for hiding this comment

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

depends_on works via #436 now - This is simply removing the ability to provide extra/explicit dependencies in the manifest, which I decided isn't really an important feature yet (and if it becomes one, might have to work differently, merging dependencies with the spec analysis, or similar).

@brandonbloom
Copy link
Member Author

I did some testing on this and ran in to a problem where dependency resolution can fail in a non-deterministic way because of the janky way in which Apply works now. In short, we delete & recreate things, and then during that interim we might try to resolve names, but the components have been temporarily deleted. This is pretty problematic, and just more evidence that we need to do a major overhaul of the reconciliation engine.

@brandonbloom brandonbloom marked this pull request as draft November 19, 2021 21:53
@brandonbloom
Copy link
Member Author

This is back to draft, since it's broken. Going to work on overhauling the internals to make this actually easier to get working right.

@brandonbloom brandonbloom mentioned this pull request Nov 22, 2021
@brandonbloom
Copy link
Member Author

Closing in favor of ongoing work in #543

@brandonbloom brandonbloom deleted the dynamic-deps-2 branch May 14, 2022 00:48
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