Fix password authentication in worker (#3124)

This commit is contained in:
Peter Schafhalter
2018-11-06 13:40:03 -08:00
committed by Robert Nishihara
parent 8356a01dd6
commit f3efcd2342
4 changed files with 26 additions and 4 deletions
+4 -1
View File
@@ -37,7 +37,10 @@ class Cluster(object):
head_node_args = head_node_args or {}
self.add_node(**head_node_args)
if connect:
ray.init(redis_address=self.redis_address)
redis_password = head_node_args.get("redis_password")
ray.init(
redis_address=self.redis_address,
redis_password=redis_password)
def add_node(self, **override_kwargs):
"""Adds a node to the local Ray Cluster.
+17 -1
View File
@@ -7,6 +7,7 @@ import pytest
import redis
import ray
from ray.test.cluster_utils import Cluster
@pytest.fixture
@@ -29,7 +30,6 @@ class TestRedisPassword(object):
os.environ.get("RAY_USE_NEW_GCS") == "on",
reason="New GCS API doesn't support Redis authentication yet.")
def test_redis_password(self, password, shutdown_only):
# Workaround for https://github.com/ray-project/ray/issues/3045
@ray.remote
def f():
return 1
@@ -52,3 +52,19 @@ class TestRedisPassword(object):
redis_client = redis.StrictRedis(
host=redis_ip, port=redis_port, password=password)
assert redis_client.ping()
@pytest.mark.skipif(
os.environ.get("RAY_USE_NEW_GCS") == "on",
reason="New GCS API doesn't support Redis authentication yet.")
def test_redis_password_cluster(self, password, shutdown_only):
@ray.remote
def f():
return 1
node_args = {"redis_password": password}
cluster = Cluster(
initialize_head=True, connect=True, head_node_args=node_args)
cluster.add_node(**node_args)
object_id = f.remote()
ray.get(object_id)