-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[Data][Autoscaler][3/N] Ensure cluster autoscaler V2 scales nodes with GPUs #59366
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9b7fe22
Initial commit
bveeramani 3e536c0
Remove dead file
bveeramani f787584
Rename environment variables
bveeramani a4e1c45
Appease lint
bveeramani 8300379
Initial commit
bveeramani ddd8410
Address review comments
bveeramani e850c42
Initial commit
bveeramani 6b2b61e
Update test
bveeramani 9b8e1e4
Update python/ray/data/_internal/cluster_autoscaler/default_cluster_a…
bveeramani fcdf444
Update python/ray/data/_internal/cluster_autoscaler/resource_utility_…
bveeramani 11a3a7b
Update python/ray/data/_internal/cluster_autoscaler/resource_utility_…
bveeramani 06825ce
Add test to BAZEL file
bveeramani edefb20
Merge branch 'new-default-autoscaler' into refactor-autoscaler-util
bveeramani 8f79567
Merge branch 'refactor-autoscaler-util' of https://github.com/ray-pro…
bveeramani ea0ef90
Resolve merge conflicts
bveeramani 8e01ef5
Merge branch 'new-default-autoscaler' into refactor-autoscaler-util
bveeramani 84de935
Fix tests
bveeramani 55291fd
Update docstring
bveeramani d20ab28
Rename files
bveeramani ced7d85
Merge branch 'master' into refactor-autoscaler-util
bveeramani cc872db
Resolve merge conflicts
bveeramani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
python/ray/data/_internal/cluster_autoscaler/resource_utilization_gauge.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import abc | ||
|
|
||
| from ray.data._internal.average_calculator import TimeWindowAverageCalculator | ||
| from ray.data._internal.execution.interfaces import ExecutionResources | ||
| from ray.data._internal.execution.resource_manager import ResourceManager | ||
|
|
||
| ClusterUtil = ExecutionResources | ||
|
|
||
|
|
||
| class ResourceUtilizationGauge(abc.ABC): | ||
| @abc.abstractmethod | ||
| def observe(self): | ||
| """Observe the cluster utilization.""" | ||
| ... | ||
|
|
||
| @abc.abstractmethod | ||
| def get(self) -> ClusterUtil: | ||
| """Get the resource cluster utilization.""" | ||
| ... | ||
|
|
||
|
|
||
| class RollingLogicalUtilizationGauge(ResourceUtilizationGauge): | ||
|
|
||
| # Default time window in seconds to calculate the average of cluster utilization. | ||
| DEFAULT_CLUSTER_UTIL_AVG_WINDOW_S: int = 10 | ||
|
|
||
| def __init__( | ||
| self, | ||
| resource_manager: ResourceManager, | ||
| *, | ||
| cluster_util_avg_window_s: float = DEFAULT_CLUSTER_UTIL_AVG_WINDOW_S, | ||
| ): | ||
| self._resource_manager = resource_manager | ||
|
|
||
| self._cluster_cpu_util_calculator = TimeWindowAverageCalculator( | ||
| cluster_util_avg_window_s | ||
| ) | ||
| self._cluster_gpu_util_calculator = TimeWindowAverageCalculator( | ||
| cluster_util_avg_window_s | ||
| ) | ||
| self._cluster_obj_mem_util_calculator = TimeWindowAverageCalculator( | ||
| cluster_util_avg_window_s | ||
| ) | ||
|
|
||
| def observe(self): | ||
| """Report the cluster utilization based on global usage / global limits.""" | ||
|
|
||
| def save_div(numerator, denominator): | ||
| if not denominator: | ||
| return 0 | ||
| else: | ||
| return numerator / denominator | ||
|
|
||
| global_usage = self._resource_manager.get_global_usage() | ||
| global_limits = self._resource_manager.get_global_limits() | ||
|
|
||
| cpu_util = save_div(global_usage.cpu, global_limits.cpu) | ||
| gpu_util = save_div(global_usage.gpu, global_limits.gpu) | ||
| obj_store_mem_util = save_div( | ||
| global_usage.object_store_memory, global_limits.object_store_memory | ||
| ) | ||
|
|
||
| self._cluster_cpu_util_calculator.report(cpu_util) | ||
| self._cluster_gpu_util_calculator.report(gpu_util) | ||
| self._cluster_obj_mem_util_calculator.report(obj_store_mem_util) | ||
|
|
||
| def get(self) -> ExecutionResources: | ||
| """Get the average cluster utilization based on global usage / global limits.""" | ||
| return ExecutionResources( | ||
| cpu=self._cluster_cpu_util_calculator.get_average(), | ||
| gpu=self._cluster_gpu_util_calculator.get_average(), | ||
| object_store_memory=self._cluster_obj_mem_util_calculator.get_average(), | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.