mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 08:31:42 +08:00
Fix password authentication in worker (#3124)
This commit is contained in:
committed by
Robert Nishihara
parent
8356a01dd6
commit
f3efcd2342
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user