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

[autoscaler] Auto detect memory resource #14567

Merged
merged 12 commits into from
Mar 16, 2021

Conversation

ConeyLiu
Copy link
Contributor

@ConeyLiu ConeyLiu commented Mar 9, 2021

Why are these changes needed?

In the current autoscaler, we could auto detect cpu/gpu resources. However, we could not know the memory size when min_workers set to zero. This could lead to those tasks with memory requirements that could not be satisfied forever.

This patch adds memory auto detecting for k8s and aws.

Related issue number

Closes #14553

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@ConeyLiu
Copy link
Contributor Author

ConeyLiu commented Mar 9, 2021

cc @ericl, this problem exists in both ray 1.1.0 and 1.2.0.

@ericl
Copy link
Contributor

ericl commented Mar 9, 2021

Will this also override the object_store_memory settings on the node when it starts? This is a little dangerous since the safe value for object_store_memory depends on factors such as the size of /dev/shm, and is in general un-knowable until the node is actually up. Since it's not allowed to use object_store_memory as a resource request any more, I think we should drop that from this PR at least.

Setting "memory" is relatively safe since it's only a scheduling hint.

@ericl ericl added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Mar 9, 2021
@ConeyLiu ConeyLiu changed the title [autoscaler] Auto detect memory and object_store_memory [autoscaler] Auto detect memory resource Mar 10, 2021
Copy link
Contributor

@wuisawesome wuisawesome left a comment

Choose a reason for hiding this comment

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

Left a few comments. Can we also update AutoscalingConfigTest.testValidateDefaultConfig and AutoscalingConfigTest.testValidateDefaultConfigAWSMultiNodeTypes

python/ray/autoscaler/_private/aws/node_provider.py Outdated Show resolved Hide resolved
python/ray/autoscaler/_private/aws/node_provider.py Outdated Show resolved Hide resolved
python/ray/autoscaler/_private/kubernetes/config.py Outdated Show resolved Hide resolved
@ConeyLiu
Copy link
Contributor Author

Hi @wuisawesome, thanks for reviewing.

Can we also update AutoscalingConfigTest.testValidateDefaultConfig and AutoscalingConfigTest.testValidateDefaultConfigAWSMultiNodeTypes

You mean to add more tests? testValidateDefaultConfigAWSMultiNodeTypes has updated. Not sure what should do for testValidateDefaultConfig

autodetected_resources.update(
config["available_node_types"][node_type]["resources"])
config["available_node_types"][node_type][
"resources"] = autodetected_resources
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this!

autodetected_resources = {"CPU": cpus}
if node_type != head_node_type:
Copy link
Contributor Author

@ConeyLiu ConeyLiu Mar 13, 2021

Choose a reason for hiding this comment

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

We only need to autodetect the worker node type memory resources. Because the head node type memory can be updated from runtime. And also the head node type memory is total_memory * (1 - REDIS_PROPORTION - OBJECT_STORE_PROPORTION), however the worker node type is total_memory * (1 - OBJECT_STORE_PROPORTION).

@AmeerHajAli AmeerHajAli removed the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Mar 15, 2021
@AmeerHajAli
Copy link
Contributor

@wuisawesome @ericl @DmitriGekhtman , do the new changes look good to you?

@DmitriGekhtman
Copy link
Contributor

@wuisawesome @ericl @DmitriGekhtman , do the new changes look good to you?

K8s part looks good.

@ericl ericl removed their assignment Mar 15, 2021
Copy link
Contributor

@AmeerHajAli AmeerHajAli left a comment

Choose a reason for hiding this comment

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

Thanks @ConeyLiu for this great contribution! We greatly value that. We look forward to more PRs from you!

@AmeerHajAli AmeerHajAli merged commit c3d8ef1 into ray-project:master Mar 16, 2021
@ConeyLiu
Copy link
Contributor Author

thanks all.

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.

[kubernetes][autoscaler] Autodetected resources override the manual ones when autoscaling with K8s
5 participants