-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Utility] add env_float
utility into ray._private.ray_constants
#47117
[Utility] add env_float
utility into ray._private.ray_constants
#47117
Conversation
Signed-off-by: Hongpeng Guo <[email protected]>
env_float
utility into ray._private.ray_constant
env_float
utility into ray._private.ray_constant
env_float
utility into ray._private.ray_constants
@@ -23,6 +23,21 @@ def env_integer(key, default): | |||
return default | |||
|
|||
|
|||
def env_float(key, 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.
QQ: Any use cases where we set float in env_var?
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.
Good question! In some cases in runtime, it's better to use float numbers for timeout_values
, especially when comparing them to real-time (float) values. Reading them as floats makes more sense in those scenarios.
Add a unit test for this function? |
Also thought about this. But it seems we don't have tests for |
…ay-project#47117) The current codebase includes `env_bool` and `env_integer` functions that directly convert environment variable strings into their respective types. To extend this functionality, we also need an `env_float` function to safely convert strings representing floating-point numbers into the `float` type." Signed-off-by: Hongpeng Guo <[email protected]>
…ay-project#47117) The current codebase includes `env_bool` and `env_integer` functions that directly convert environment variable strings into their respective types. To extend this functionality, we also need an `env_float` function to safely convert strings representing floating-point numbers into the `float` type." Signed-off-by: Hongpeng Guo <[email protected]>
Why are these changes needed?
The current codebase includes
env_bool
andenv_integer
functions that directly convert environment variable strings into their respective types. To extend this functionality, we also need anenv_float
function to safely convert strings representing floating-point numbers into thefloat
type."Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.