-
Notifications
You must be signed in to change notification settings - Fork 6k
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] Introduce fail_on_unavailable option for hard NodeAffinitySchedulingStrategy #36718
Changes from all commits
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 |
---|---|---|
|
@@ -472,6 +472,29 @@ def get_node_id_task(sleep_s=0): | |
assert target_node_id != soft_node_id | ||
|
||
|
||
def test_node_affinity_scheduling_strategy_fail_on_unavailable(ray_start_cluster): | ||
cluster = ray_start_cluster | ||
cluster.add_node(num_cpus=1) | ||
ray.init(address=cluster.address) | ||
|
||
@ray.remote(num_cpus=1) | ||
class Actor: | ||
def get_node_id(self): | ||
return ray.get_runtime_context().get_node_id() | ||
|
||
a1 = Actor.remote() | ||
target_node_id = ray.get(a1.get_node_id.remote()) | ||
|
||
a2 = Actor.options( | ||
scheduling_strategy=NodeAffinitySchedulingStrategy( | ||
target_node_id, soft=False, _fail_on_unavailable=True | ||
) | ||
).remote() | ||
|
||
with pytest.raises(ray.exceptions.ActorUnschedulableError): | ||
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. Should we have a better error message (and a test) in this case? I think it'd be great the exception contains a message like the task couldn't be scheduled, and _fail_on_unavailable is set to true? 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. Yea, I think we should if we make it public. For now, I think it's fine to not have an error message since it's private and I will just use it in serve and I don't need to know the error message. |
||
ray.get(a2.get_node_id.remote()) | ||
|
||
|
||
@pytest.mark.parametrize("connect_to_client", [True, False]) | ||
def test_spread_scheduling_strategy(ray_start_cluster, connect_to_client): | ||
cluster = ray_start_cluster | ||
|
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.
Is all the combination tested actually? IIUC, the behavior is
can you make sure all these scenarios are tested?
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.
Currently invalid combinations will check failure since these are private options now and not used by users. Once we make them public, we need to throw proper exceptions. All the valid combinations are tested.