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-2153]Optimize Placement of predicateCheckResult for Better Maintainability #1011

Closed
wants to merge 5 commits into from

Conversation

kaichiachen
Copy link
Contributor

@kaichiachen kaichiachen commented Jan 25, 2025

What is this PR for?

Create predicate.go to encapsulate the declaration and implementation of predicateCheckResult, improves code organization by centralizing predicate-related logic, enhancing maintainability and readability.

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/projects/YUNIKORN/issues/YUNIKORN-2153

How should this be tested?

  1. Unit test
#> go tool cover -func=coverage.out | grep predicates.go                    
github.com/apache/yunikorn-core/pkg/scheduler/objects/predicates.go:41:                 betterThan                                      100.0%
github.com/apache/yunikorn-core/pkg/scheduler/objects/predicates.go:45:                 getSolutionScore                                100.0%
github.com/apache/yunikorn-core/pkg/scheduler/objects/predicates.go:76:                 isSatisfactory                                  100.0%
github.com/apache/yunikorn-core/pkg/scheduler/objects/predicates.go:80:                 populateVictims                                 100.0%
github.com/apache/yunikorn-core/pkg/scheduler/objects/predicates.go:117:                preemptPredicateCheck                           100.0%
github.com/apache/yunikorn-core/pkg/scheduler/objects/predicates.go:150:                String                                          100.0%
  1. Manual Preemtion test
    2.1 Create cluster with kind and install yunikorn
    2.2 Create pods with low priority but request a lot of resources
    2.3 Create a pod with higher priority
    2.4 Some of pods created at 2.2 are eviction and pod in 2.3 can be scheduled to k8s cluster

Screenshots (if appropriate)

Questions:

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

@kaichiachen kaichiachen marked this pull request as draft January 25, 2025 11:50
@kaichiachen kaichiachen changed the title Optimize Placement of predicateCheckResult for Better Maintainability [YUNIKORN-2153]Optimize Placement of predicateCheckResult for Better Maintainability Jan 28, 2025
@kaichiachen kaichiachen marked this pull request as ready for review January 28, 2025 08:32
@chenyulin0719 chenyulin0719 self-requested a review February 6, 2025 01:12
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.65%. Comparing base (7391aeb) to head (d042252).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1011      +/-   ##
==========================================
+ Coverage   82.48%   82.65%   +0.17%     
==========================================
  Files          97       98       +1     
  Lines       15627    15645      +18     
==========================================
+ Hits        12890    12932      +42     
+ Misses       2457     2438      -19     
+ Partials      280      275       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@chenyulin0719 chenyulin0719 left a comment

Choose a reason for hiding this comment

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

A small missing function:

  • preemption_test.go#allocForScore should be moved to predicates_test.go

@kaichiachen
Copy link
Contributor Author

A small missing function:

  • preemption_test.go#allocForScore should be moved to predicates_test.go

Good catch, thanks!

@pbacsko
Copy link
Contributor

pbacsko commented Feb 7, 2025

Run "make lint" locally before you push to see linter issues.

@kaichiachen
Copy link
Contributor Author

Run "make lint" locally before you push to see linter issues.

Sorry, the current golangci-lint tool version is 1.57.2. I am not sure why it consumes my laptop huge memory usage(macos/darwin/arm64) and is never completed locally. I am trying to bump version locally and verified

Copy link
Contributor

@chenyulin0719 chenyulin0719 left a comment

Choose a reason for hiding this comment

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

+1 LGTM

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