-
Notifications
You must be signed in to change notification settings - Fork 140
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
[YUNIKORN-2578] Refactor SchedulerCache.GetPod() remove bool return #837
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #837 +/- ##
==========================================
- Coverage 66.06% 66.02% -0.05%
==========================================
Files 69 69
Lines 7547 7549 +2
==========================================
- Hits 4986 4984 -2
- Misses 2348 2352 +4
Partials 213 213 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryankert01 thanks for this refactor. one small suggestion is left. PTAL
@@ -645,8 +645,7 @@ func (ctx *Context) IsPodFitNode(name, node string, allocate bool) error { | |||
ctx.lock.RLock() | |||
defer ctx.lock.RUnlock() | |||
var pod *v1.Pod | |||
var ok bool | |||
if pod, ok = ctx.schedulerCache.GetPod(name); !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pod := ctx.schedulerCache.GetPod(name)
if pod == nil {
return ErrorPodNotFound
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
What is this PR for?
SchedulerCache GetPod() and GetPodNoLock() retrun two values:
The boolean value is redundant as it is false if the pod is not found and a nil is returned for the pod. The boolean is true if the pod has a value. Testing for a nil pod has the same result.
We do not cache a nil pod in the cache for a pod UID
What type of PR is it?
Todos
What is the Jira issue?
https://issues.apache.org/jira/browse/YUNIKORN-2578
How should this be tested?
make test
github ci
Screenshots (if appropriate)
Questions: