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

Reorganize comment and remove unnessary message to reduce confusion #4407

Closed
wants to merge 2 commits into from

Conversation

sophia-guo
Copy link
Contributor

Close #4404

Signed-off-by: Sophia Guo [email protected]

@@ -230,8 +226,11 @@ timestamps{
}
}
}
// No agents available, start VM agent.
// When Parallel the race condition could happen. Say the number of multiply jobs is larger than the available nodes the query's result may be delayed and wrong
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// When Parallel the race condition could happen. Say the number of multiply jobs is larger than the available nodes the query's result may be delayed and wrong
// When running in parallel, a race condition could occur. If for example, the number of multiply jobs is greater than the available nodes, then the query's result may be delayed and incorrect

@@ -230,8 +226,11 @@ timestamps{
}
}
}
// No agents available, start VM agent.
// When Parallel the race condition could happen. Say the number of multiply jobs is larger than the available nodes the query's result may be delayed and wrong
// In this case jobs will be fooled to fall back to wait local busy nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand this comment.

Copy link
Contributor

@smlambert smlambert left a comment

Choose a reason for hiding this comment

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

We have too many different terms in the comments for just 2 main things that we are working with in this piece of code:

  • static Jenkins nodes
  • dynamic agents
    We could stick to those terms, and replace anything else to avoid confusion. Where virtual agent, VM agent, vm terms are used, we could replace with one term, dynamic agent. Where idle nodes, agents, nodes terms are used, could replace with one term, static Jenkins nodes.

The idea of this code is:
"If dynamic agents are supported for this platform, then we consider to use them, but we prefer to utilize the static Jenkins nodes first, if they are available. If no static Jenkins nodes are available, spin up a dynamic agent.

If a bunch of jobs get launched at once, because a parent job triggered parallel jobs to be run, there may be a situation, where all of those jobs ask the same question at the same time, are there static Jenkins nodes available? The response to all of those simultaneous questions may be delayed and no longer valid. In this situation, this code will fall back to wait for static Jenkins nodes to become available, instead of spinning up a dynamic agent."

Not suitable for code comments, but for separate documentation that we should also write, it may be easier to understand with an example:
3 static Jenkins nodes are available, a parent job requests to run tests in parallel across 4 nodes. All 4 child jobs run this setup code and ask if static nodes are available. Because they all ask at the same time, the Jenkins server may respond to all 4 child jobs that static nodes are available, but only 3 will get deployed onto those nodes. The 4th child job, will now wait for a static Jenkins node to become available, rather than spinning up a dynamic agent.

@smlambert
Copy link
Contributor

@sophia-guo - do you still want to try to update this one to get it in?

@karianna
Copy link
Contributor

Needs a rebase

@sophia-guo
Copy link
Contributor Author

Close this one as outdated.

@sophia-guo sophia-guo closed this Aug 15, 2023
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.

Update the printout message of dynamic agents check to reduce the confusion
3 participants