-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[serve] Set "memory"
to None
in ray_actor_options
by default
#23619
Conversation
alternatively, try unset the field if not specified? This should work with any future Ray default values. |
@suquark @shrekris-anyscale I'm not quite understanding the context here. Does this mean that setting memory to |
@edoakes yes, Ray "intentionally" does not support 0 memory (but you can set memory=None), limited here: ray/python/ray/_private/utils.py Line 357 in 3e80da7
memory=None to memory=0
|
@edoakes @simon-mo In that case, should we set the default |
@shrekris-anyscale yes I think we should just set it to |
"memory"
in ray_actor_options
1"memory"
to None
in ray_actor_options
by default
@edoakes I changed the default to |
@@ -258,13 +258,14 @@ def _validate(self): | |||
raise ValueError("num_gpus in ray_actor_options must be >= 0.") | |||
self.resource_dict["GPU"] = num_gpus | |||
|
|||
if self.ray_actor_options.get("memory", None) is None: | |||
self.ray_actor_options["memory"] = 0 | |||
self.ray_actor_options.setdefault("memory", None) | |||
memory = self.ray_actor_options["memory"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually you should not change the options (this changes options, making it harder to understand and debug), you just skip setting memory
, that will make memory None
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by changes options? Wouldn't setting memory
to None
and not setting memory
at all have identical effects? These ray_actor_options
ultimately get passed into an actor's options
call, which also sets memory
to None
by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later PR deprecates this behavior (also see #api-changes): #23127. But it does not matter too much.
also I am thinking if we should be explicit about default values? when users want to set memory to I strongly feel it is a bad design if the default value is bound with |
This change raises an exception if the user passes in 0. Assuming Ray doesn't use 0 by default, the |
Why are these changes needed?
By default, Serve sets
"memory"
inray_actor_options
to 0. However, this is simply ignored in theresources_from_resource_arguments()
function. Additionally, setting memory to 0 is explicitly disallowed in theto_memory_units()
function.This change sets Serve's default value for
"memory"
toNone
, so it uses Ray's default"memory"
value.Related issue number
Closes #23616.
Checks
scripts/format.sh
to lint the changes in this PR.test_config.py
.