Skip to content
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

Revert "Enable Ray client server by default" #13429

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions doc/source/ray-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ Ray Client
Basic usage
===========

The Ray client server is automatically started on port ``10001`` when you use ``ray start --head`` or Ray in an autoscaling cluster. The port can be changed by specifying --ray-client-server-port in the ``ray start`` command.

To start the server manually, you can run:
While in beta, the server is available as an executable module. To start the server, run

``python -m ray.util.client.server [--host host_ip] [--port port] [--redis-address address] [--redis-password password]``

This runs ``ray.init()`` with default options and exposes the client gRPC port at ``host_ip:port`` (by default, ``0.0.0.0:10001``). Providing ``redis-address`` and ``redis-password`` will be passed into ``ray.init()`` when the server starts, allowing connection to an existing Ray cluster, as per the `cluster setup <cluster/index.html>`_ instructions.
This runs ``ray.init()`` with default options and exposes the client gRPC port at ``host_ip:port`` (by default, ``0.0.0.0:50051``). Providing ``redis-address`` and ``redis-password`` will be passed into ``ray.init()`` when the server starts, allowing connection to an existing Ray cluster, as per the `cluster setup <cluster/index.html>`_ instructions.

From here, another Ray script can access that server from a networked machine with ``ray.util.connect()``

Expand All @@ -25,7 +23,7 @@ From here, another Ray script can access that server from a networked machine wi
import ray
import ray.util

ray.util.connect("<head_node_host>:10001") # replace with the appropriate host and port
ray.util.connect("0.0.0.0:50051") # replace with the appropriate host and port

# Normal Ray code follows
@ray.remote
Expand All @@ -34,12 +32,13 @@ From here, another Ray script can access that server from a networked machine wi

do_work.remote(2)
#....

When the client disconnects, any object or actor references held by the server on behalf of the client are dropped, as if directly disconnecting from the cluster.

============
Known issues
============
When the client disconnects, any object or actor references held by the server on behalf of the client are dropped, as if directly disconnecting from the cluster


===================
``RAY_CLIENT_MODE``
===================

Because Ray client mode affects the behavior of the Ray API, larger scripts or libraries imported before ``ray.util.connect()`` may not realize they're in client mode. This feature is being tracked with `issue #13272 <https://github.com/ray-project/ray/issues/13272>`_ but the workaround here is provided for beta users.

Expand All @@ -50,3 +49,21 @@ Therefore, an environment variable is also available to force a Ray program into
.. code-block:: bash

RAY_CLIENT_MODE=1 python my_ray_program.py


===================================
Programatically creating the server
===================================

For larger use-cases, it may be desirable to connect remote Ray clients to an existing Ray environment. The server can be started separately via

.. code-block:: python

from ray.util.client.server import serve

server = serve("0.0.0.0:50051")
# Server does some work
# ...
# Time to clean up
server.stop(0)

2 changes: 1 addition & 1 deletion python/ray/scripts/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def debug(address):
"--ray-client-server-port",
required=False,
type=int,
default=10001,
default=None,
help="the port number the ray client server will bind on. If not set, "
"the ray client server will not be started.")
@click.option(
Expand Down
4 changes: 2 additions & 2 deletions python/ray/tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self):
assert len(actor_table) == 1

job_table = ray.jobs()
assert len(job_table) == 3 # dash, ray client server
assert len(job_table) == 2

# Kill the driver process.
p.kill()
Expand Down Expand Up @@ -79,7 +79,7 @@ def value(self):
assert len(actor_table) == 1

job_table = ray.jobs()
assert len(job_table) == 3 # dash, ray client server
assert len(job_table) == 2

# Kill the driver process.
p.kill()
Expand Down