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

[core] Expose Redis getter to Python and use to retrieve session name #39194

Merged
merged 17 commits into from
Sep 5, 2023
Prev Previous commit
Next Next commit
Fix test advanced 9
  • Loading branch information
rkooo567 committed Sep 5, 2023
commit 5c2ea1d212b7721779eda5a465d9c68b63da296b
11 changes: 3 additions & 8 deletions python/ray/includes/global_state_accessor.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,9 @@ cdef extern from * namespace "ray::gcs" nogil:
instrumented_io_context io_service;

auto redis_client = std::make_shared<RedisClient>(options);
try {
auto status = redis_client->Connect(io_service);
if(!status.ok()) {
RAY_LOG(ERROR) << "Failed to connect to redis: " << status.ToString();
return false;
}
} catch (std::exception& e) {
RAY_LOG(ERROR) << "Failed to connect to redis: " << e.what();
auto status = redis_client->Connect(io_service);
if(!status.ok()) {
RAY_LOG(ERROR) << "Failed to connect to redis: " << status.ToString();
return false;
}

Expand Down
5 changes: 3 additions & 2 deletions python/ray/tests/test_advanced_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ def check_demands(n):

@pytest.mark.skipif(enable_external_redis(), reason="Only valid in non redis env")
def test_redis_not_available(monkeypatch, call_ray_stop_only):
monkeypatch.setenv("RAY_NUM_REDIS_GET_RETRIES", "2")
monkeypatch.setenv("RAY_redis_db_connect_retries", "5")
monkeypatch.setenv("RAY_REDIS_ADDRESS", "localhost:12345")

p = subprocess.run(
"ray start --head",
shell=True,
Expand All @@ -369,7 +370,7 @@ def test_redis_not_available(monkeypatch, call_ray_stop_only):

@pytest.mark.skipif(not enable_external_redis(), reason="Only valid in redis env")
def test_redis_wrong_password(monkeypatch, external_redis, call_ray_stop_only):
monkeypatch.setenv("RAY_NUM_REDIS_GET_RETRIES", "2")
monkeypatch.setenv("RAY_redis_db_connect_retries", "5")
p = subprocess.run(
"ray start --head --redis-password=1234",
shell=True,
Expand Down
4 changes: 4 additions & 0 deletions python/ray/tests/test_gcs_fault_tolerance.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,12 @@ def test_redis_logs(external_redis):
["ray", "start", "--head"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
stdout, stderr = process.communicate(timeout=30)
print(stdout.decode())
print(stderr.decode())
assert "redis_context.cc" not in stderr.decode()
assert "redis_context.cc" not in stdout.decode()
assert "Resolve Redis address" not in stderr.decode()
assert "Resolve Redis address" not in stdout.decode()
# assert "redis_context.cc" not in result.output
finally:
from click.testing import CliRunner
Expand Down
Loading