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

fix: merged resource limit is affected by remaining in the resource group. #2696

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

yomybaby
Copy link
Member

@yomybaby yomybaby commented Sep 6, 2024

TL;DR

Fixed and refactored resource limit and remaining calculations in useResourceLimitAndRemaining hook.

This PR resolves the issue where the merged resource limit in useResourceLimitAndRemaining is affected by the remaining in the resource group.

Now, the maximum value is determined as the minimum value of the following:

  • pre-container configuration (e.g., maxCPUCoresPerContainer)
  • keypair resource limit
  • group resource limit

The useResourceLimitAndRemaining should consider the domain resource limit and the total slot size of the resource group. This will be handled by another PR.

What changed?

  • Updated ResourceLimits type to use ResourceSlotName as key
  • Commented out resourceGroupResourceSize calculations for cpu and mem
  • Added keypair and group limits for accelerators
  • Updated type assertions in remaining resource calculations

How to test?

  1. Test resource allocation functionality in the UI
  2. Verify that resource limits are correctly applied for different resource types (CPU, memory, accelerators)
  3. Check that remaining resources are calculated accurately
  4. Ensure that the changes don't introduce any regressions in resource management

Copy link

graphite-app bot commented Sep 6, 2024

Your org requires the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Member Author

yomybaby commented Sep 6, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @yomybaby and the rest of your teammates on Graphite Graphite

@github-actions github-actions bot added the size:S 10~30 LoC label Sep 6, 2024
@yomybaby yomybaby changed the title fix: merged resource limit affected by resource group remaining fixe: merged resource limit is affected by remaining in the resource group. Sep 6, 2024
Copy link

github-actions bot commented Sep 6, 2024

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements 5.47% 337/6156
🔴 Branches
5.06% (+0% 🔼)
214/4230
🔴 Functions 3.11% 63/2023
🔴 Lines 5.37% 323/6012

Test suite run success

90 tests passing in 11 suites.

Report generated by 🧪jest coverage report action from 40b6062

@yomybaby yomybaby force-pushed the fix/resource-limit-and-resource-group-size branch from d990267 to 7b4e8e9 Compare September 9, 2024 01:45
@github-actions github-actions bot added size:M 30~100 LoC and removed size:S 10~30 LoC labels Sep 9, 2024
@yomybaby yomybaby changed the title fixe: merged resource limit is affected by remaining in the resource group. fix: merged resource limit is affected by remaining in the resource group. Sep 9, 2024
@yomybaby yomybaby marked this pull request as ready for review September 9, 2024 02:05
Copy link
Contributor

@ironAiken2 ironAiken2 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
Contributor

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

graphite-app bot commented Sep 9, 2024

Merge activity

…roup. (#2696)

### TL;DR

Fixed and refactored resource limit and remaining calculations in useResourceLimitAndRemaining hook.

This PR resolves the issue where the merged resource limit in useResourceLimitAndRemaining is affected by the remaining in the resource group.

Now, the maximum value is determined as the minimum value of the following:

- pre-container configuration (e.g., maxCPUCoresPerContainer)
- keypair resource limit
- group resource limit

The useResourceLimitAndRemaining should consider the domain resource limit and the total slot size of the resource group. This will be handled by another PR.

### What changed?

- Updated ResourceLimits type to use ResourceSlotName as key
- Commented out resourceGroupResourceSize calculations for cpu and mem
- Added keypair and group limits for accelerators
- Updated type assertions in remaining resource calculations

### How to test?

1. Test resource allocation functionality in the UI
2. Verify that resource limits are correctly applied for different resource types (CPU, memory, accelerators)
3. Check that remaining resources are calculated accurately
4. Ensure that the changes don't introduce any regressions in resource management
@yomybaby yomybaby force-pushed the fix/resource-limit-and-resource-group-size branch from 7b4e8e9 to 40b6062 Compare September 9, 2024 08:37
@graphite-app graphite-app bot merged commit 40b6062 into main Sep 9, 2024
6 checks passed
@graphite-app graphite-app bot deleted the fix/resource-limit-and-resource-group-size branch September 9, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M 30~100 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants