Fix CI test failures (#4007)

This commit is contained in:
Yuhong Guo
2019-02-11 11:01:14 +08:00
committed by Hao Chen
parent e703b9f49d
commit 5fb1efd60d
4 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ from ray.tune.logger import pretty_print, UnifiedLogger
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
@@ -311,7 +311,7 @@ class Trial(object):
@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."""
+6 -6
View File
@@ -38,7 +38,7 @@ from ray import ObjectID, DriverID, ActorID, ActorHandleID, ClientID, TaskID
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
@@ -186,7 +186,7 @@ class Worker(object):
# 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 "
@@ -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.")
@@ -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.
@@ -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)
@@ -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;
}
}
+3 -3
View File
@@ -1074,7 +1074,7 @@ def test_actors_and_tasks_with_gpus(ray_start_cluster):
@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
@@ -1085,7 +1085,7 @@ def test_actors_and_tasks_with_gpus(ray_start_cluster):
@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
@@ -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]