mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[serve] Don't create placement group for deployment with no resources (#20471)
This commit is contained in:
parent
08655ab812
commit
186c16c50e
2 changed files with 18 additions and 2 deletions
|
@ -167,12 +167,17 @@ class ActorReplicaWrapper:
|
|||
"""
|
||||
Start a new actor for current DeploymentReplica instance.
|
||||
"""
|
||||
self._actor_resources = deployment_info.replica_config.resource_dict
|
||||
self._max_concurrent_queries = (
|
||||
deployment_info.deployment_config.max_concurrent_queries)
|
||||
self._graceful_shutdown_timeout_s = (
|
||||
deployment_info.deployment_config.graceful_shutdown_timeout_s)
|
||||
if USE_PLACEMENT_GROUP:
|
||||
|
||||
self._actor_resources = deployment_info.replica_config.resource_dict
|
||||
# it is currently not possiible to create a placement group
|
||||
# with no resources (https://github.com/ray-project/ray/issues/20401)
|
||||
has_resources_assigned = all(
|
||||
(r > 0 for r in self._actor_resources.values()))
|
||||
if USE_PLACEMENT_GROUP and has_resources_assigned:
|
||||
self._placement_group = self.create_placement_group(
|
||||
self._placement_group_name, self._actor_resources)
|
||||
|
||||
|
|
|
@ -1098,6 +1098,17 @@ def test_deploy_change_route_prefix(serve_instance):
|
|||
wait_for_condition(check_switched)
|
||||
|
||||
|
||||
@pytest.mark.timeout(10, method="thread")
|
||||
def test_deploy_empty_bundle(serve_instance):
|
||||
@serve.deployment(ray_actor_options={"num_cpus": 0})
|
||||
class D:
|
||||
def hello(self, _):
|
||||
return "hello"
|
||||
|
||||
# This should succesfully terminate within the provided time-frame.
|
||||
D.deploy()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
sys.exit(pytest.main(["-v", "-s", __file__]))
|
||||
|
|
Loading…
Add table
Reference in a new issue