-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Core] Non Unit Instance fractional value fix #39293
Changes from 11 commits
b73674b
6d69971
eba2d75
f485d3f
3b3dcf3
f90109e
14bc2a1
d471d0d
cb9b173
36763d9
947f04a
edc06ab
0516fcc
fe67907
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,4 +193,8 @@ The precision of the fractional resource requirement is 0.0001 so you should avo | |
.. tip:: | ||
|
||
Besides resource requirements, you can also specify an environment for a task or actor to run in, | ||
which can include Python packages, local files, environment variables, and more---see :ref:`Runtime Environments <runtime-environments>` for details. | ||
which can include Python packages, local files, environment variables, and more. See :ref:`Runtime Environments <runtime-environments>` for details. | ||
|
||
.. note:: | ||
Unit resource requirements that are greater than 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. People usually don't know what unit resources are. We should just list them out like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the GPU, TPU and neuron core are written on the next line |
||
need to be whole numbers. For example, ``num_gpus=1.5`` is invalid. This restriction applies to resources that the scheduler assigns using IDs such as GPU, TPU, and Neuron Core. |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -640,10 +640,14 @@ cdef int prepare_resources( | |||||||||
if value < 0: | ||||||||||
raise ValueError("Resource quantities may not be negative.") | ||||||||||
if value > 0: | ||||||||||
unit_resources = f"{RayConfig.instance().predefined_unit_instance_resources()},\ | ||||||||||
{RayConfig.instance().custom_unit_instance_resources()}" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets split by (,) and convert them to a set and then check. Otherwise, we may mismatch: e.g. we have a unit resource called Foo_Bar and you will think Foo is also unit resource. |
||||||||||
|
||||||||||
if (value >= 1 and isinstance(value, float) | ||||||||||
and not value.is_integer()): | ||||||||||
and not value.is_integer() and str(key) in unit_resources): | ||||||||||
raise ValueError( | ||||||||||
"Resource quantities >1 must be whole numbers.") | ||||||||||
"Unit instance resource (GPU, TPU, Neuron Core) quantities >1 must", | ||||||||||
f" be whole numbers. {key} resource with value {value} is invalid.") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
resource_map[0][key.encode("ascii")] = float(value) | ||||||||||
return 0 | ||||||||||
|
||||||||||
|
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.
Can you move it to be above
tip
?