Skip to content

Commit

Permalink
[Core] convert gcs port read from env variable from str to int (ray-p…
Browse files Browse the repository at this point in the history
…roject#34482)

convert the variable from str to int to close ray-project#33963
  • Loading branch information
scv119 authored Apr 17, 2023
1 parent 8af7814 commit f349823
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/ray/_private/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def __init__(
if head:
gcs_server_port = os.getenv(ray_constants.GCS_PORT_ENVIRONMENT_VARIABLE)
if gcs_server_port:
ray_params.update_if_absent(gcs_server_port=gcs_server_port)
ray_params.update_if_absent(gcs_server_port=int(gcs_server_port))
if ray_params.gcs_server_port is None or ray_params.gcs_server_port == 0:
ray_params.gcs_server_port = self._get_cached_port("gcs_server_port")

Expand Down
11 changes: 11 additions & 0 deletions python/ray/tests/test_basic_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time
import subprocess
from unittest.mock import Mock, patch
import unittest

import pytest

Expand Down Expand Up @@ -361,6 +362,16 @@ def verify_imports(latch):
ray.get(futures)


def test_gcs_port_env():
try:
with unittest.mock.patch.dict(os.environ):
os.environ["RAY_GCS_SERVER_PORT"] = "12345"
ray.init()
except RuntimeError:
pass
# it's ok to throw runtime error for port conflicts


if __name__ == "__main__":
if os.environ.get("PARALLEL_CI"):
sys.exit(pytest.main(["-n", "auto", "--boxed", "-vs", __file__]))
Expand Down

0 comments on commit f349823

Please sign in to comment.