Skip to content

Commit 91316bd

Browse files
committed
This comment fix some small defects.
1. Remove a comment that should have been removed in ray-project#3003 2. Remove `redis_protected_mode` that is never used in `ray.init()` 3. Fix `object_id_seed` that is forgotten to be passed into `ray._init()` 4. Remove several redundant brackets.
1 parent 9948e8c commit 91316bd

File tree

3 files changed

+29
-32
lines changed

3 files changed

+29
-32
lines changed

python/ray/scripts/scripts.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -432,24 +432,24 @@ def stop():
432432
"--min-workers",
433433
required=False,
434434
type=int,
435-
help=("Override the configured min worker node count for the cluster."))
435+
help="Override the configured min worker node count for the cluster.")
436436
@click.option(
437437
"--max-workers",
438438
required=False,
439439
type=int,
440-
help=("Override the configured max worker node count for the cluster."))
440+
help="Override the configured max worker node count for the cluster.")
441441
@click.option(
442442
"--cluster-name",
443443
"-n",
444444
required=False,
445445
type=str,
446-
help=("Override the configured cluster name."))
446+
help="Override the configured cluster name.")
447447
@click.option(
448448
"--yes",
449449
"-y",
450450
is_flag=True,
451451
default=False,
452-
help=("Don't ask for confirmation."))
452+
help="Don't ask for confirmation.")
453453
def create_or_update(cluster_config_file, min_workers, max_workers, no_restart,
454454
restart_only, yes, cluster_name):
455455
if restart_only or no_restart:
@@ -465,19 +465,19 @@ def create_or_update(cluster_config_file, min_workers, max_workers, no_restart,
465465
"--workers-only",
466466
is_flag=True,
467467
default=False,
468-
help=("Only destroy the workers."))
468+
help="Only destroy the workers.")
469469
@click.option(
470470
"--yes",
471471
"-y",
472472
is_flag=True,
473473
default=False,
474-
help=("Don't ask for confirmation."))
474+
help="Don't ask for confirmation.")
475475
@click.option(
476476
"--cluster-name",
477477
"-n",
478478
required=False,
479479
type=str,
480-
help=("Override the configured cluster name."))
480+
help="Override the configured cluster name.")
481481
def teardown(cluster_config_file, yes, workers_only, cluster_name):
482482
teardown_cluster(cluster_config_file, yes, workers_only, cluster_name)
483483

@@ -488,17 +488,17 @@ def teardown(cluster_config_file, yes, workers_only, cluster_name):
488488
"--start",
489489
is_flag=True,
490490
default=False,
491-
help=("Start the cluster if needed."))
491+
help="Start the cluster if needed.")
492492
@click.option(
493-
"--tmux", is_flag=True, default=False, help=("Run the command in tmux."))
493+
"--tmux", is_flag=True, default=False, help="Run the command in tmux.")
494494
@click.option(
495495
"--cluster-name",
496496
"-n",
497497
required=False,
498498
type=str,
499-
help=("Override the configured cluster name."))
499+
help="Override the configured cluster name.")
500500
@click.option(
501-
"--new", "-N", is_flag=True, help=("Force creation of a new screen."))
501+
"--new", "-N", is_flag=True, help="Force creation of a new screen.")
502502
def attach(cluster_config_file, start, tmux, cluster_name, new):
503503
attach_cluster(cluster_config_file, start, tmux, cluster_name, new)
504504

@@ -512,7 +512,7 @@ def attach(cluster_config_file, start, tmux, cluster_name, new):
512512
"-n",
513513
required=False,
514514
type=str,
515-
help=("Override the configured cluster name."))
515+
help="Override the configured cluster name.")
516516
def rsync_down(cluster_config_file, source, target, cluster_name):
517517
rsync(cluster_config_file, source, target, cluster_name, down=True)
518518

@@ -526,7 +526,7 @@ def rsync_down(cluster_config_file, source, target, cluster_name):
526526
"-n",
527527
required=False,
528528
type=str,
529-
help=("Override the configured cluster name."))
529+
help="Override the configured cluster name.")
530530
def rsync_up(cluster_config_file, source, target, cluster_name):
531531
rsync(cluster_config_file, source, target, cluster_name, down=False)
532532

@@ -538,27 +538,27 @@ def rsync_up(cluster_config_file, source, target, cluster_name):
538538
"--stop",
539539
is_flag=True,
540540
default=False,
541-
help=("Stop the cluster after the command finishes running."))
541+
help="Stop the cluster after the command finishes running.")
542542
@click.option(
543543
"--start",
544544
is_flag=True,
545545
default=False,
546-
help=("Start the cluster if needed."))
546+
help="Start the cluster if needed.")
547547
@click.option(
548548
"--screen",
549549
is_flag=True,
550550
default=False,
551-
help=("Run the command in a screen."))
551+
help="Run the command in a screen.")
552552
@click.option(
553-
"--tmux", is_flag=True, default=False, help=("Run the command in tmux."))
553+
"--tmux", is_flag=True, default=False, help="Run the command in tmux.")
554554
@click.option(
555555
"--cluster-name",
556556
"-n",
557557
required=False,
558558
type=str,
559-
help=("Override the configured cluster name."))
559+
help="Override the configured cluster name.")
560560
@click.option(
561-
"--port-forward", required=False, type=int, help=("Port to forward."))
561+
"--port-forward", required=False, type=int, help="Port to forward.")
562562
def exec_cmd(cluster_config_file, cmd, screen, tmux, stop, start, cluster_name,
563563
port_forward):
564564
assert not (screen and tmux), "Can specify only one of `screen` or `tmux`."
@@ -576,7 +576,7 @@ def exec_cmd(cluster_config_file, cmd, screen, tmux, stop, start, cluster_name,
576576
"-n",
577577
required=False,
578578
type=str,
579-
help=("Override the configured cluster name."))
579+
help="Override the configured cluster name.")
580580
def get_head_ip(cluster_config_file, cluster_name):
581581
click.echo(get_head_node_ip(cluster_config_file, cluster_name))
582582

python/ray/services.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,21 @@ def cleanup():
187187
logger.warning("Ray did not shut down properly.")
188188

189189

190-
def all_processes_alive(exclude=[]):
190+
def all_processes_alive(exclude=None):
191191
"""Check if all of the processes are still alive.
192192
193193
Args:
194194
exclude: Don't check the processes whose types are in this list.
195195
"""
196+
197+
if exclude is None:
198+
exclude = []
196199
for process_type, processes in all_processes.items():
197200
# Note that p.poll() returns the exit code that the process exited
198201
# with, so an exit code of None indicates that the process is still
199202
# alive.
200203
processes_alive = [p.poll() is None for p in processes]
201-
if (not all(processes_alive) and process_type not in exclude):
204+
if not all(processes_alive) and process_type not in exclude:
202205
logger.warning(
203206
"A process of type {} has died.".format(process_type))
204207
return False
@@ -358,7 +361,7 @@ def _compute_version_info():
358361
ray_version = ray.__version__
359362
python_version = ".".join(map(str, sys.version_info[:3]))
360363
pyarrow_version = pyarrow.__version__
361-
return (ray_version, python_version, pyarrow_version)
364+
return ray_version, python_version, pyarrow_version
362365

363366

364367
def _put_version_info_in_redis(redis_client):

python/ray/worker.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,6 @@ class Worker(object):
201201

202202
def __init__(self):
203203
"""Initialize a Worker object."""
204-
# This is a dictionary mapping driver ID to a dictionary that maps
205-
# remote function IDs for that driver to a counter of the number of
206-
# times that remote function has been executed on this worker. The
207-
# counter is incremented every time the function is executed on this
208-
# worker. When the counter reaches the maximum number of executions
209-
# allowed for a particular function, the worker is killed.
210204
self.connected = False
211205
self.mode = None
212206
self.cached_functions_to_run = []
@@ -1645,7 +1639,6 @@ def init(redis_address=None,
16451639
ignore_reinit_error=False,
16461640
num_redis_shards=None,
16471641
redis_max_clients=None,
1648-
redis_protected_mode=True,
16491642
plasma_directory=None,
16501643
huge_pages=False,
16511644
include_webui=True,
@@ -1761,6 +1754,7 @@ def init(redis_address=None,
17611754
address_info=info,
17621755
start_ray_local=(redis_address is None),
17631756
num_workers=num_workers,
1757+
object_id_seed=object_id_seed,
17641758
local_mode=local_mode,
17651759
driver_mode=driver_mode,
17661760
redirect_worker_output=redirect_worker_output,
@@ -1823,9 +1817,9 @@ def shutdown(worker=global_worker):
18231817
# besides possibly the worker itself.
18241818
for process_type, processes in services.all_processes.items():
18251819
if process_type == services.PROCESS_TYPE_WORKER:
1826-
assert (len(processes)) <= 1
1820+
assert len(processes) <= 1
18271821
else:
1828-
assert (len(processes) == 0)
1822+
assert len(processes) == 0
18291823

18301824
worker.set_mode(None)
18311825

0 commit comments

Comments
 (0)