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

[YUNIKORN-2578] Refactor SchedulerCache.GetPod() remove bool return #837

Closed
wants to merge 2 commits into from

Conversation

ryankert01
Copy link
Contributor

What is this PR for?

SchedulerCache GetPod() and GetPodNoLock() retrun two values:

  1. *v1.Pod
  2. bool
    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?

  • - Bug Fix
  • - Improvement
  • - Feature
  • - Documentation
  • - Hot Fix
  • - Refactoring

Todos

  • - Task

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:

  • - The licenses files need update.
  • - There is breaking changes for older versions.
  • - It needs documentation.

Copy link

codecov bot commented May 11, 2024

Codecov Report

Attention: Patch coverage is 58.82353% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 66.02%. Comparing base (abd7011) to head (e4c9b02).
Report is 2 commits behind head on master.

Files Patch % Lines
pkg/cache/context.go 50.00% 5 Missing and 1 partial ⚠️
pkg/cache/external/scheduler_cache.go 80.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@pbacsko pbacsko requested review from pbacsko, craigcondit and wilfred-s and removed request for craigcondit May 11, 2024 07:58
Copy link
Contributor

@pbacsko pbacsko left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@chia7712 chia7712 left a 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 {
Copy link
Member

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
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@chia7712 chia7712 closed this in 3a231be May 13, 2024
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.

3 participants