Skip to content

Commit f11b006

Browse files
finish
Signed-off-by: OneSizeFitsQuorum <txypotato@gmail.com>
1 parent 44e8b1d commit f11b006

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

python/ray/util/client/worker.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from ray._private.ray_constants import DEFAULT_CLIENT_RECONNECT_GRACE_PERIOD
2525
from ray._private.runtime_env.py_modules import upload_py_modules_if_needed
2626
from ray._private.runtime_env.working_dir import upload_working_dir_if_needed
27+
from ray._private.ray_constants import env_integer, env_float
2728

2829
# Use cloudpickle's version of pickle for UnpicklingError
2930
from ray.cloudpickle.compat import pickle
@@ -52,13 +53,12 @@
5253

5354
logger = logging.getLogger(__name__)
5455

55-
INITIAL_TIMEOUT_SEC = 5
56-
MAX_TIMEOUT_SEC = 30
57-
56+
INITIAL_TIMEOUT_SEC = env_integer("RAY_CLIENT_INITIAL_CONNECTION_TIMEOUT_S", 5)
57+
MAX_TIMEOUT_SEC = env_integer("RAY_CLIENT_MAX_CONNECTION_TIMEOUT_S", 30)
5858
# The max amount of time an operation can run blocking in the server. This
5959
# allows for Ctrl-C of the client to work without explicitly cancelling server
6060
# operations.
61-
MAX_BLOCKING_OPERATION_TIME_S: float = 2.0
61+
MAX_BLOCKING_OPERATION_TIME_S: float = env_float("RAY_CLIENT_MAX_BLOCKING_OPERATION_TIME_S", 2.0)
6262

6363
# If the total size (bytes) of all outbound messages to schedule tasks since
6464
# the connection began exceeds this value, a warning should be raised
@@ -416,19 +416,14 @@ def get(self, vals, *, timeout: Optional[float] = None) -> Any:
416416
else:
417417
deadline = time.monotonic() + timeout
418418

419-
max_blocking_operation_time = MAX_BLOCKING_OPERATION_TIME_S
420-
if "RAY_CLIENT_MAX_BLOCKING_OPERATION_TIME_S" in os.environ:
421-
max_blocking_operation_time = float(
422-
os.environ["RAY_CLIENT_MAX_BLOCKING_OPERATION_TIME_S"]
423-
)
424419
while True:
425420
if deadline:
426421
op_timeout = min(
427-
max_blocking_operation_time,
422+
MAX_BLOCKING_OPERATION_TIME_S,
428423
max(deadline - time.monotonic(), 0.001),
429424
)
430425
else:
431-
op_timeout = max_blocking_operation_time
426+
op_timeout = MAX_BLOCKING_OPERATION_TIME_S
432427
try:
433428
res = self._get(to_get, op_timeout)
434429
break

0 commit comments

Comments
 (0)