Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(provisioner): handle multiple agents, apps, scripts and envs#13741

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 11 commits intomainfrom12949-apps
Jul 3, 2024

Conversation

mtojek
Copy link
Member

@mtojekmtojek commentedJul 1, 2024
edited
Loading

Fixes:#12949

This PR adjusts provisioner logic to properly handle apps, scripts, and envs assigned to different agent. Without this PR every app/script/env is assigned to every agent. Unfortunately, there isn't an easy way to achieve it, and we need to snoop the dependency information from the graph.

Note: I added a couple of .tf tests, which blew up the PR size. The code change itself is relatively small.

@mtojekmtojek self-assigned thisJul 1, 2024
@mtojekmtojek changed the titlefix: multiple agents, independent appsfix(provisioner): handle multiple agents, apps, scripts and envsJul 3, 2024
@mtojekmtojek requested a review fromjohnstcnJuly 3, 2024 11:52
@mtojekmtojek marked this pull request as ready for reviewJuly 3, 2024 11:52
Comment on lines 756 to 757
appNodeSuffix := fmt.Sprintf(`] %s.%s (expand)"`, resource.Type, resource.Name)
agentNodeSuffix := fmt.Sprintf(`] coder_agent.%s (expand)"`, agent.Name)
Copy link
Member

Choose a reason for hiding this comment

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

It's unfortunate that we need to match this :(

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yes, I agree. It is the biggest drawback of this PR, and we need to preserve the format.

Comment on lines 760 to 771
for _, dst := range graph.Edges.SrcToDsts {
for _, edges := range dst {
for _, edge := range edges {
if strings.HasSuffix(edge.Src, appNodeSuffix) &&
strings.HasSuffix(edge.Dst, agentNodeSuffix) {
return true
}
}
}
}
return false
}
Copy link
Member

Choose a reason for hiding this comment

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

My main concern is that we are traversing this graph multiple times in a tight loop.
Could we instead traverse the graph once, build a shallow map ofagent -> resource, and use that to determine the agent-resource dependency?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The main reason I'm hesitant to do this, it would be another cache/state used only to prevent this problem. Considering we have 1 agent on average, 2 in total, it may not introduce a heavy performance impact.

Anyway, if you think this is a must-do, I will improve the loop 👍 I admit, I focused mostly on fixing the problem.

Copy link
Member

Choose a reason for hiding this comment

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

That's fair. Let's make it work correctly first, and then see about benchmarking / speeding it up.

mtojek reacted with thumbs up emoji
@mtojekmtojek merged commit07d4171 intomainJul 3, 2024
28 checks passed
@mtojekmtojek deleted the 12949-apps branchJuly 3, 2024 12:55
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 3, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@mtojekmtojek

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

coder_app: When adding multiple coder_agents gets duplicated coder_app
2 participants
@mtojek@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp