Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/ray/tune/trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import ray.tune.registry
from ray.tune.result import (DEFAULT_RESULTS_DIR, DONE, HOSTNAME, PID,
TIME_TOTAL_S, TRAINING_ITERATION, TIMESTEPS_TOTAL)
from ray.utils import random_string, binary_to_hex, hex_to_binary
from ray.utils import _random_string, binary_to_hex, hex_to_binary

DEBUG_PRINT_INTERVAL = 5
MAX_LEN_IDENTIFIER = 130
Expand Down Expand Up @@ -311,7 +311,7 @@ def _registration_check(cls, trainable_name):

@classmethod
def generate_id(cls):
return binary_to_hex(random_string())[:8]
return binary_to_hex(_random_string())[:8]

def init_logger(self):
"""Init logger."""
Expand Down
12 changes: 6 additions & 6 deletions python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from ray import profiling
from ray.function_manager import (FunctionActorManager, FunctionDescriptor)
import ray.parameter
from ray.utils import (check_oversized_pickle, is_cython, random_string,
from ray.utils import (check_oversized_pickle, is_cython, _random_string,
thread_safe_client, setup_logger)

SCRIPT_MODE = 0
Expand Down Expand Up @@ -186,7 +186,7 @@ def task_context(self):
# to the current task ID may not be correct. Generate a
# random task ID so that the backend can differentiate
# between different threads.
self._task_context.current_task_id = TaskID(random_string())
self._task_context.current_task_id = TaskID(_random_string())
if getattr(self, '_multithreading_warned', False) is not True:
logger.warning(
"Calling ray.get or ray.wait in a separate thread "
Expand Down Expand Up @@ -1753,13 +1753,13 @@ def connect(info,

# Initialize some fields.
if mode is WORKER_MODE:
worker.worker_id = random_string()
worker.worker_id = _random_string()
if setproctitle:
setproctitle.setproctitle("ray_worker")
else:
# This is the code path of driver mode.
if driver_id is None:
driver_id = DriverID(random_string())
driver_id = DriverID(_random_string())

if not isinstance(driver_id, DriverID):
raise Exception("The type of given driver id must be DriverID.")
Expand Down Expand Up @@ -1911,7 +1911,7 @@ def connect(info,
function_descriptor.get_function_descriptor_list(),
[], # arguments.
0, # num_returns.
TaskID(random_string()), # parent_task_id.
TaskID(_random_string()), # parent_task_id.
0, # parent_counter.
ActorID.nil(), # actor_creation_id.
ObjectID.nil(), # actor_creation_dummy_object_id.
Expand Down Expand Up @@ -2164,7 +2164,7 @@ def register_custom_serializer(cls,
else:
# In this case, the class ID only needs to be meaningful on this
# worker and not across workers.
class_id = random_string()
class_id = _random_string()

# Make sure class_id is a string.
class_id = ray.utils.binary_to_hex(class_id)
Expand Down
10 changes: 5 additions & 5 deletions src/ray/object_manager/test/object_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,27 +342,27 @@ class TestObjectManager : public TestObjectManagerBase {
case 0: {
// Ensure timeout_ms = 0 is handled correctly.
// Out of 5 objects, we expect 3 ready objects and 2 remaining objects.
TestWait(100, 5, 3, /*timeout_ms=*/0, false, false);
TestWait(600, 5, 3, /*timeout_ms=*/0, false, false);
} break;
case 1: {
// Ensure timeout_ms = 1000 is handled correctly.
// Out of 5 objects, we expect 3 ready objects and 2 remaining objects.
TestWait(100, 5, 3, /*timeout_ms=*/1000, false, false);
TestWait(600, 5, 3, /*timeout_ms=*/1000, false, false);
} break;
case 2: {
// Generate objects locally to ensure local object code-path works properly.
// Out of 5 objects, we expect 3 ready objects and 2 remaining objects.
TestWait(100, 5, 3, 1000, false, /*test_local=*/true);
TestWait(600, 5, 3, 1000, false, /*test_local=*/true);
} break;
case 3: {
// Wait on an object that's never registered with GCS to ensure timeout works
// properly.
TestWait(100, /*num_objects=*/5, /*required_objects=*/6, 1000,
TestWait(600, /*num_objects=*/5, /*required_objects=*/6, 1000,
/*include_nonexistent=*/true, false);
} break;
case 4: {
// Ensure infinite time code-path works properly.
TestWait(100, 5, 5, /*timeout_ms=*/-1, false, false);
TestWait(600, 5, 5, /*timeout_ms=*/-1, false, false);
} break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/actor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def check_intervals_non_overlapping(list_of_intervals):
@ray.remote(num_gpus=1)
def f1():
t1 = time.monotonic()
time.sleep(0.2)
time.sleep(0.4)
t2 = time.monotonic()
gpu_ids = ray.get_gpu_ids()
assert len(gpu_ids) == 1
Expand All @@ -1085,7 +1085,7 @@ def f1():
@ray.remote(num_gpus=2)
def f2():
t1 = time.monotonic()
time.sleep(0.2)
time.sleep(0.4)
t2 = time.monotonic()
gpu_ids = ray.get_gpu_ids()
assert len(gpu_ids) == 2
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def test_actors_and_tasks_with_gpus_version_two(shutdown_only):

@ray.remote(num_gpus=1)
def f():
time.sleep(4)
time.sleep(5)
gpu_ids = ray.get_gpu_ids()
assert len(gpu_ids) == 1
return gpu_ids[0]
Expand Down