Rename redis-port to port and add default (#8406)

This commit is contained in:
Max Fitton 2020-05-18 11:25:34 -07:00 committed by GitHub
parent 2cff471d2c
commit 13231ba63b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 52 additions and 36 deletions

View file

@ -25,11 +25,12 @@ Starting Ray on each machine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On the head node (just choose some node to be the head node), run the following. On the head node (just choose some node to be the head node), run the following.
If the ``--redis-port`` argument is omitted, Ray will choose a port at random. If the ``--port`` argument is omitted, Ray will choose port 6379, falling back to a
random port.
.. code-block:: bash .. code-block:: bash
ray start --head --redis-port=6379 ray start --head --port=6379
The command will print out the address of the Redis server that was started The command will print out the address of the Redis server that was started
(and some other address information). (and some other address information).

View file

@ -4,7 +4,6 @@ import weakref
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from collections import namedtuple from collections import namedtuple
import ray.ray_constants as ray_constants import ray.ray_constants as ray_constants
import ray._raylet import ray._raylet
import ray.signature as signature import ray.signature as signature

View file

@ -111,7 +111,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --num-redis-shards=10 --redis-port=6379 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -n 65536; ray start --head --num-redis-shards=10 --port=6379 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -134,7 +134,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -n 65536; ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -119,7 +119,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -n 65536; ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -122,7 +122,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -n 65536; ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -92,7 +92,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -n 65536; ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -124,7 +124,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -n 65536; ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -149,7 +149,7 @@ head_start_ray_commands:
ulimit -n 65536; ulimit -n 65536;
ray start ray start
--head --head
--redis-port=6379 --port=6379
--object-manager-port=8076 --object-manager-port=8076
--autoscaling-config=~/ray_bootstrap_config.yaml --autoscaling-config=~/ray_bootstrap_config.yaml

View file

@ -158,7 +158,7 @@ head_start_ray_commands:
ulimit -n 65536; ulimit -n 65536;
ray start ray start
--head --head
--redis-port=6379 --port=6379
--object-manager-port=8076 --object-manager-port=8076
--autoscaling-config=~/ray_bootstrap_config.yaml --autoscaling-config=~/ray_bootstrap_config.yaml

View file

@ -238,7 +238,7 @@ worker_setup_commands: []
# Note webui-host is set to 0.0.0.0 so that kubernetes can port forward. # Note webui-host is set to 0.0.0.0 so that kubernetes can port forward.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -n 65536; ray start --head --num-cpus=$MY_CPU_REQUEST --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --webui-host 0.0.0.0 - ulimit -n 65536; ray start --head --num-cpus=$MY_CPU_REQUEST --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --webui-host 0.0.0.0
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -26,7 +26,7 @@ setup_commands:
# - source activate ray && cd ray/python && pip install -e . # - source activate ray && cd ray/python && pip install -e .
head_start_ray_commands: head_start_ray_commands:
- source activate ray && ray stop - source activate ray && ray stop
- source activate ray && ulimit -c unlimited && ray start --head --redis-port=6379 --autoscaling-config=~/ray_bootstrap_config.yaml - source activate ray && ulimit -c unlimited && ray start --head --port=6379 --autoscaling-config=~/ray_bootstrap_config.yaml
worker_start_ray_commands: worker_start_ray_commands:
- source activate ray && ray stop - source activate ray && ray stop
- source activate ray && ray start --address=$RAY_HEAD_IP:6379 - source activate ray && ray start --address=$RAY_HEAD_IP:6379

View file

@ -75,7 +75,7 @@ worker_setup_commands: []
# Command to start ray on the head node. You don't need to change this. # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ulimit -c unlimited && ray start --head --redis-port=6379 --autoscaling-config=~/ray_bootstrap_config.yaml - ulimit -c unlimited && ray start --head --port=6379 --autoscaling-config=~/ray_bootstrap_config.yaml
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -32,6 +32,9 @@ OBJECT_STORE_MINIMUM_MEMORY_BYTES = 75 * 1024 * 1024
DEFAULT_REDIS_MAX_MEMORY_BYTES = 10**10 DEFAULT_REDIS_MAX_MEMORY_BYTES = 10**10
# The smallest cap on the memory used by Redis that we allow. # The smallest cap on the memory used by Redis that we allow.
REDIS_MINIMUM_MEMORY_BYTES = 10**7 REDIS_MINIMUM_MEMORY_BYTES = 10**7
# If a user does not specify a port for the primary Ray service,
# we attempt to start the service running at this port.
DEFAULT_PORT = 6379
# Default resource requirements for actors when no resource requirements are # Default resource requirements for actors when no resource requirements are
# specified. # specified.

View file

@ -127,7 +127,15 @@ def dashboard(cluster_config_file, cluster_name, port):
"--redis-port", "--redis-port",
required=False, required=False,
type=str, type=str,
help="the port to use for starting Redis") help="(DEPRECATED) the port to use for starting redis. "
"Please use --port instead now.")
@click.option(
"--port",
required=False,
type=str,
help="the port of the head ray process. If not provided, tries to use "
"{0}, falling back to a random port if {0} is "
"not available".format(ray_constants.DEFAULT_PORT))
@click.option( @click.option(
"--num-redis-shards", "--num-redis-shards",
required=False, required=False,
@ -279,7 +287,7 @@ def dashboard(cluster_config_file, cluster_name, port):
is_flag=True, is_flag=True,
default=False, default=False,
help="Specify whether load code from local file or GCS serialization.") help="Specify whether load code from local file or GCS serialization.")
def start(node_ip_address, redis_address, address, redis_port, def start(node_ip_address, redis_address, address, redis_port, port,
num_redis_shards, redis_max_clients, redis_password, num_redis_shards, redis_max_clients, redis_password,
redis_shard_ports, object_manager_port, node_manager_port, memory, redis_shard_ports, object_manager_port, node_manager_port, memory,
object_store_memory, redis_max_memory, num_cpus, num_gpus, resources, object_store_memory, redis_max_memory, num_cpus, num_gpus, resources,
@ -291,6 +299,12 @@ def start(node_ip_address, redis_address, address, redis_port,
if redis_address is not None: if redis_address is not None:
raise DeprecationWarning("The --redis-address argument is " raise DeprecationWarning("The --redis-address argument is "
"deprecated. Please use --address instead.") "deprecated. Please use --address instead.")
if redis_port is not None:
logger.warn("The --redis-port argument will be deprecated soon. "
"Please use --port instead.")
if port is not None and port != redis_port:
raise ValueError("Cannot specify both --port and --redis-port "
"as port is a rename of deprecated redis-port")
# Convert hostnames to numerical IP address. # Convert hostnames to numerical IP address.
if node_ip_address is not None: if node_ip_address is not None:
@ -361,7 +375,7 @@ def start(node_ip_address, redis_address, address, redis_port,
logger.info("Using IP address {} for this node.".format( logger.info("Using IP address {} for this node.".format(
ray_params.node_ip_address)) ray_params.node_ip_address))
ray_params.update_if_absent( ray_params.update_if_absent(
redis_port=redis_port, redis_port=port or redis_port,
redis_shard_ports=redis_shard_ports, redis_shard_ports=redis_shard_ports,
redis_max_memory=redis_max_memory, redis_max_memory=redis_max_memory,
num_redis_shards=num_redis_shards, num_redis_shards=num_redis_shards,
@ -392,8 +406,9 @@ def start(node_ip_address, redis_address, address, redis_port,
if redis_password else "")) if redis_password else ""))
else: else:
# Start Ray on a non-head node. # Start Ray on a non-head node.
if redis_port is not None: if not (redis_port is None and port is None):
raise Exception("If --head is not passed in, --redis-port is not " raise Exception(
"If --head is not passed in, --port and --redis-port are not "
"allowed.") "allowed.")
if redis_shard_ports is not None: if redis_shard_ports is not None:
raise Exception("If --head is not passed in, --redis-shard-ports " raise Exception("If --head is not passed in, --redis-shard-ports "

View file

@ -873,8 +873,9 @@ def _start_redis_instance(executable,
Notes: Notes:
If "port" is not None, then we will only use this port and try If "port" is not None, then we will only use this port and try
only once. Otherwise, random ports will be used and the maximum only once. Otherwise, we will first try the default redis port,
retries count is "num_retries". and if it is unavailable, we will try random ports with
maximum retries of "num_retries".
Args: Args:
executable (str): Full path of the redis-server executable. executable (str): Full path of the redis-server executable.
@ -912,7 +913,7 @@ def _start_redis_instance(executable,
# This ensures that we will use the given port. # This ensures that we will use the given port.
num_retries = 1 num_retries = 1
else: else:
port = new_port() port = ray_constants.DEFAULT_PORT
load_module_args = [] load_module_args = []
for module in modules: for module in modules:

View file

@ -27,4 +27,4 @@ setup_commands:
# # Command to start ray on the head node. You don't need to change this. # # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml - ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml

View file

@ -360,7 +360,7 @@ def test_calling_start_ray_head(call_ray_stop_only):
subprocess.check_output(["ray", "stop"]) subprocess.check_output(["ray", "stop"])
# Test starting Ray with a redis port specified. # Test starting Ray with a redis port specified.
subprocess.check_output(["ray", "start", "--head", "--redis-port", "6379"]) subprocess.check_output(["ray", "start", "--head"])
subprocess.check_output(["ray", "stop"]) subprocess.check_output(["ray", "stop"])
# Test starting Ray with a node IP address specified. # Test starting Ray with a node IP address specified.
@ -398,10 +398,9 @@ def test_calling_start_ray_head(call_ray_stop_only):
# Test starting Ray with all arguments specified. # Test starting Ray with all arguments specified.
subprocess.check_output([ subprocess.check_output([
"ray", "start", "--head", "--redis-port", "6379", "ray", "start", "--head", "--redis-shard-ports", "6380,6381,6382",
"--redis-shard-ports", "6380,6381,6382", "--object-manager-port", "--object-manager-port", "12345", "--num-cpus", "2", "--num-gpus",
"12345", "--num-cpus", "2", "--num-gpus", "0", "0", "--redis-max-clients", "100", "--resources", "{\"Custom\": 1}"
"--redis-max-clients", "100", "--resources", "{\"Custom\": 1}"
]) ])
subprocess.check_output(["ray", "stop"]) subprocess.check_output(["ray", "stop"])
@ -438,10 +437,8 @@ def test_calling_start_ray_head(call_ray_stop_only):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"call_ray_start", [ "call_ray_start",
"ray start --head --num-cpus=1 " + ["ray start --head --num-cpus=1 " + "--node-ip-address=localhost"],
"--node-ip-address=localhost --redis-port=6379"
],
indirect=True) indirect=True)
def test_using_hostnames(call_ray_start): def test_using_hostnames(call_ray_start):
ray.init(node_ip_address="localhost", address="localhost:6379") ray.init(node_ip_address="localhost", address="localhost:6379")

View file

@ -75,7 +75,7 @@ worker_setup_commands:
# # Command to start ray on the head node. You don't need to change this. # # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000 - ray start --head --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -93,7 +93,7 @@ worker_setup_commands: []
# # Command to start ray on the head node. You don't need to change this. # # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000 - ray start --head --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands:

View file

@ -89,7 +89,7 @@ worker_setup_commands: []
# # Command to start ray on the head node. You don't need to change this. # # Command to start ray on the head node. You don't need to change this.
head_start_ray_commands: head_start_ray_commands:
- ray stop - ray stop
- ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000 - ray start --head --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000
# Command to start ray on worker nodes. You don't need to change this. # Command to start ray on worker nodes. You don't need to change this.
worker_start_ray_commands: worker_start_ray_commands: