mirror of
https://github.com/vale981/ray
synced 2025-03-06 18:41:40 -05:00
This reverts commit 39aa01fc2c
.
This commit is contained in:
parent
ecb94b3fe9
commit
d8f8583e80
8 changed files with 6 additions and 39 deletions
|
@ -651,7 +651,6 @@ def start(
|
|||
http_port: int = DEFAULT_HTTP_PORT,
|
||||
http_middlewares: List[Any] = [],
|
||||
http_options: Optional[Union[dict, HTTPOptions]] = None,
|
||||
dedicated_cpu: bool = False,
|
||||
) -> Client:
|
||||
"""Initialize a serve instance.
|
||||
|
||||
|
@ -676,7 +675,7 @@ def start(
|
|||
this to "0.0.0.0".
|
||||
- port(int): Port for HTTP server. Defaults to 8000.
|
||||
- middlewares(list): A list of Starlette middlewares that will be
|
||||
applied to the HTTP servers in the cluster. Defaults to [].
|
||||
applied to the HTTP servers in the cluster.
|
||||
- location(str, serve.config.DeploymentMode): The deployment
|
||||
location of HTTP servers:
|
||||
|
||||
|
@ -685,10 +684,6 @@ def start(
|
|||
on. This is the default.
|
||||
- "EveryNode": start one HTTP server per node.
|
||||
- "NoServer" or None: disable HTTP server.
|
||||
- num_cpus (int): The number of CPU cores to reserve for each
|
||||
internal Serve HTTP proxy actor. Defaults to 0.
|
||||
dedicated_cpu (bool): Whether to reserve a CPU core for the internal
|
||||
Serve controller actor. Defaults to False.
|
||||
"""
|
||||
if ((http_host != DEFAULT_HTTP_HOST) or (http_port != DEFAULT_HTTP_PORT)
|
||||
or (len(http_middlewares) != 0)):
|
||||
|
@ -733,7 +728,6 @@ def start(
|
|||
host=http_host, port=http_port, middlewares=http_middlewares)
|
||||
|
||||
controller = ServeController.options(
|
||||
num_cpus=(1 if dedicated_cpu else 0),
|
||||
name=controller_name,
|
||||
lifetime="detached" if detached else None,
|
||||
max_restarts=-1,
|
||||
|
|
|
@ -244,7 +244,6 @@ class HTTPOptions(pydantic.BaseModel):
|
|||
port: int = DEFAULT_HTTP_PORT
|
||||
middlewares: List[Any] = []
|
||||
location: Optional[DeploymentMode] = DeploymentMode.HeadOnly
|
||||
num_cpus: int = 0
|
||||
|
||||
@validator("location", always=True)
|
||||
def location_backfill_no_server(cls, v, values):
|
||||
|
|
|
@ -38,7 +38,7 @@ CHECKPOINT_KEY = "serve-controller-checkpoint"
|
|||
CONTROL_LOOP_PERIOD_S = 0.1
|
||||
|
||||
|
||||
@ray.remote(num_cpus=0)
|
||||
@ray.remote
|
||||
class ServeController:
|
||||
"""Responsible for managing the state of the serving system.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import ray
|
|||
from ray import serve
|
||||
import requests
|
||||
|
||||
ray.init()
|
||||
ray.init(num_cpus=4)
|
||||
serve.start()
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import ray
|
|||
from ray import serve
|
||||
import requests
|
||||
|
||||
ray.init()
|
||||
ray.init(num_cpus=4)
|
||||
serve.start()
|
||||
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class HTTPProxy:
|
|||
await self.router(scope, receive, send)
|
||||
|
||||
|
||||
@ray.remote(num_cpus=0)
|
||||
@ray.remote
|
||||
class HTTPProxyActor:
|
||||
def __init__(self,
|
||||
host: str,
|
||||
|
|
|
@ -69,7 +69,6 @@ class HTTPState:
|
|||
name, node_id, self._config.host,
|
||||
self._config.port))
|
||||
proxy = HTTPProxyActor.options(
|
||||
num_cpus=self._config.num_cpus,
|
||||
name=name,
|
||||
lifetime="detached" if self._detached else None,
|
||||
max_concurrency=ASYNC_CONCURRENCY,
|
||||
|
|
|
@ -15,7 +15,6 @@ from ray.serve.constants import SERVE_PROXY_NAME
|
|||
from ray.serve.exceptions import RayServeException
|
||||
from ray.serve.utils import (block_until_http_ready, get_all_node_ids,
|
||||
format_actor_name)
|
||||
from ray.serve.config import HTTPOptions
|
||||
from ray.test_utils import wait_for_condition
|
||||
from ray._private.services import new_port
|
||||
|
||||
|
@ -122,30 +121,6 @@ def test_connect(detached, ray_shutdown):
|
|||
assert "backend-ception" in serve.list_backends().keys()
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows")
|
||||
@pytest.mark.parametrize("controller_cpu", [True, False])
|
||||
@pytest.mark.parametrize("num_proxy_cpus", [0, 1, 2])
|
||||
def test_dedicated_cpu(controller_cpu, num_proxy_cpus, ray_cluster):
|
||||
cluster = ray_cluster
|
||||
num_cluster_cpus = 8
|
||||
head_node = cluster.add_node(num_cpus=num_cluster_cpus)
|
||||
|
||||
ray.init(head_node.address)
|
||||
wait_for_condition(
|
||||
lambda: ray.cluster_resources().get("CPU") == num_cluster_cpus)
|
||||
|
||||
num_cpus_used = int(controller_cpu) + num_proxy_cpus
|
||||
|
||||
serve.start(
|
||||
dedicated_cpu=controller_cpu,
|
||||
http_options=HTTPOptions(num_cpus=num_proxy_cpus))
|
||||
available_cpus = num_cluster_cpus - num_cpus_used
|
||||
wait_for_condition(
|
||||
lambda: (ray.available_resources().get("CPU") == available_cpus))
|
||||
serve.shutdown()
|
||||
ray.shutdown()
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not hasattr(socket, "SO_REUSEPORT"),
|
||||
reason=("Port sharing only works on newer verion of Linux. "
|
||||
|
@ -329,7 +304,7 @@ def test_http_head_only(ray_cluster):
|
|||
r["CPU"]
|
||||
for r in ray.state.state._available_resources_per_node().values()
|
||||
}
|
||||
assert cpu_per_nodes == {4, 4}
|
||||
assert cpu_per_nodes == {2, 4}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Reference in a new issue