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-2795] Handle Preemption cases between two siblings without … #944

Closed
wants to merge 3 commits into from

Conversation

manirajv06
Copy link
Contributor

…causing preemption loop

What is this PR for?

Different preemption cases between siblings under common under guaranteed parent needs to be handled properly without causing preemption storm or loop. Please refer https://docs.google.com/document/d/1vfv8XJJsIqlZN3ecyhP2EFeiUSQnY-9GHEi_UJFB-BU/edit for more details.

A fixable case without causing storm or loop is freeing up resources from victim child queue (not guaranteed set) to under guaranteed preemptor who is starving for resources located under common under guaranteed parent. This case has been discussed in the doc under section 2a)

What type of PR is it?

  • - Improvement

Todos

  • - Task

What is the Jira issue?

https://issues.apache.org/jira/browse/YUNIKORN-2795

How should this be tested?

Screenshots (if appropriate)

Questions:

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

@manirajv06 manirajv06 self-assigned this Aug 13, 2024
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.43%. Comparing base (6939b13) to head (ad11714).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #944      +/-   ##
==========================================
+ Coverage   80.41%   80.43%   +0.02%     
==========================================
  Files          97       97              
  Lines       12431    12437       +6     
==========================================
+ Hits         9996    10004       +8     
+ Misses       2164     2163       -1     
+ Partials      271      270       -1     

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

Comment on lines +27 to +41
var smallestRes = resources.NewResourceFromMap(map[string]resources.Quantity{"first": 5})
var childRes = resources.NewResourceFromMap(map[string]resources.Quantity{"second": 5})
var smallestResPlusChildRes = resources.Add(smallestRes, childRes)
var smallestResDouble = resources.Multiply(smallestRes, 2)
var smallestResDoublePlusChildRes = resources.Add(resources.Multiply(smallestRes, 2), childRes)
var smallestResMultiplyByZero = resources.NewResourceFromMap(map[string]resources.Quantity{"first": 0})
var smallestResMultiplyByMinusOne = resources.Multiply(smallestRes, -1)
var smallestResMultiplyByMinusOnePlusChildRes = resources.Add(resources.Multiply(smallestRes, -1), childRes)
var childResMultiplyByZero = resources.NewResourceFromMap(map[string]resources.Quantity{"second": 0})
var childResMultiplyByMinusOne = resources.Multiply(childRes, -1)
var childResDouble = resources.Multiply(childRes, 2)
var smallestResDoublePlusChildResDouble = resources.Add(resources.Multiply(smallestRes, 2), childResDouble)
var smallestResPlusChildResDouble = resources.Add(smallestRes, childResDouble)
var smallestResMultiplyByZeroPluschildResMultiplyByZero = resources.Add(smallestResMultiplyByZero, childResMultiplyByZero)
var smallestResMultiplyByZeroPluschildResMultiplyByMinusOne = resources.Add(smallestResMultiplyByZero, childResMultiplyByMinusOne)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be better to just create the resource map in-place wherever it's needed? These variables barely reveal what they contain, the names are way too long sometimes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with this, please simplify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified the variable names like usual test variables. Couple of jiras YUNIKORN-2848 & YUNIKORN-2824 has been already raised which would re-use these variables eventually.

@craigcondit
Copy link
Contributor

This needs a rebase on master now that SubOnlyExisting() has been updated.

Copy link
Contributor

@craigcondit craigcondit left a comment

Choose a reason for hiding this comment

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

Minor changes.

pkg/scheduler/objects/preemption.go Show resolved Hide resolved
Comment on lines +27 to +41
var smallestRes = resources.NewResourceFromMap(map[string]resources.Quantity{"first": 5})
var childRes = resources.NewResourceFromMap(map[string]resources.Quantity{"second": 5})
var smallestResPlusChildRes = resources.Add(smallestRes, childRes)
var smallestResDouble = resources.Multiply(smallestRes, 2)
var smallestResDoublePlusChildRes = resources.Add(resources.Multiply(smallestRes, 2), childRes)
var smallestResMultiplyByZero = resources.NewResourceFromMap(map[string]resources.Quantity{"first": 0})
var smallestResMultiplyByMinusOne = resources.Multiply(smallestRes, -1)
var smallestResMultiplyByMinusOnePlusChildRes = resources.Add(resources.Multiply(smallestRes, -1), childRes)
var childResMultiplyByZero = resources.NewResourceFromMap(map[string]resources.Quantity{"second": 0})
var childResMultiplyByMinusOne = resources.Multiply(childRes, -1)
var childResDouble = resources.Multiply(childRes, 2)
var smallestResDoublePlusChildResDouble = resources.Add(resources.Multiply(smallestRes, 2), childResDouble)
var smallestResPlusChildResDouble = resources.Add(smallestRes, childResDouble)
var smallestResMultiplyByZeroPluschildResMultiplyByZero = resources.Add(smallestResMultiplyByZero, childResMultiplyByZero)
var smallestResMultiplyByZeroPluschildResMultiplyByMinusOne = resources.Add(smallestResMultiplyByZero, childResMultiplyByMinusOne)
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with this, please simplify.

@manirajv06
Copy link
Contributor Author

This failure should go away with apache/yunikorn-k8shim#897. Triggering the workflows to get a clean build.

@craigcondit
Copy link
Contributor

This failure should go away with apache/yunikorn-k8shim#897.

apache/yunikorn-k8shim#897 merged; I've kicked off the build on the PR again to verify.

Copy link
Contributor

@craigcondit craigcondit 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