From cf419648165f356eb64b903ad7911d407cd0467b Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Wed, 16 Aug 2017 01:18:32 -0700 Subject: [PATCH] Fix some bugs causing Travis test failures. (#839) * Fix bug in which worker has no actor_class attribute. * Remove case where we check if processes are defunct. --- python/ray/actor.py | 4 +++- python/ray/test/test_utils.py | 9 +-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/python/ray/actor.py b/python/ray/actor.py index 703b1d57e..168a82488 100644 --- a/python/ray/actor.py +++ b/python/ray/actor.py @@ -6,6 +6,7 @@ import cloudpickle as pickle import hashlib import inspect import json +import time import traceback import ray.local_scheduler @@ -215,7 +216,8 @@ def reconstruct_actor_state(actor_id, worker): print("Loading actor state from checkpoint {}" .format(checkpoint_index)) # Wait for the actor to have been defined. - worker._wait_for_actor() + while not hasattr(worker, "actor_class"): + time.sleep(0.001) # TODO(rkn): Restoring from the checkpoint may fail, so this should be # in a try-except block and we should give a good error message. worker.actors[actor_id] = ( diff --git a/python/ray/test/test_utils.py b/python/ray/test/test_utils.py index 179ad8117..adca6b00e 100644 --- a/python/ray/test/test_utils.py +++ b/python/ray/test/test_utils.py @@ -4,7 +4,6 @@ from __future__ import print_function import json import os -import psutil import redis import time @@ -115,18 +114,12 @@ def _pid_alive(pid): pid: The pid to check. Returns: - This returns false if the process is dead or defunct. Otherwise, it - returns true. + This returns false if the process is dead. Otherwise, it returns true. """ try: os.kill(pid, 0) except OSError: return False - else: - if psutil.Process(pid).status() == psutil.STATUS_ZOMBIE: - return False - else: - return True def wait_for_pid_to_exit(pid, timeout=20):