Properly mock ray submodules when building documentation. (#337)

This commit is contained in:
Robert Nishihara
2017-03-04 23:02:56 -08:00
committed by Philipp Moritz
parent 0a233b7144
commit a7ddac6fb1
8 changed files with 74 additions and 59 deletions
+4 -4
View File
@@ -9,7 +9,7 @@ import numpy as np
import random
import traceback
import ray.local_scheduler as local_scheduler
import ray.local_scheduler
import ray.pickling as pickling
import ray.worker
import ray.experimental.state as state
@@ -30,7 +30,7 @@ def random_string():
return np.random.bytes(20)
def random_actor_id():
return local_scheduler.ObjectID(random_string())
return ray.local_scheduler.ObjectID(random_string())
def get_actor_method_function_id(attr):
"""Get the function ID corresponding to an actor method.
@@ -45,13 +45,13 @@ def get_actor_method_function_id(attr):
function_id_hash.update(attr.encode("ascii"))
function_id = function_id_hash.digest()
assert len(function_id) == 20
return local_scheduler.ObjectID(function_id)
return ray.local_scheduler.ObjectID(function_id)
def fetch_and_register_actor(key, worker):
"""Import an actor."""
driver_id, actor_id_str, actor_name, module, pickled_class, assigned_gpu_ids, actor_method_names = \
worker.redis_client.hmget(key, ["driver_id", "actor_id", "name", "module", "class", "gpu_ids", "actor_method_names"])
actor_id = local_scheduler.ObjectID(actor_id_str)
actor_id = ray.local_scheduler.ObjectID(actor_id_str)
actor_name = actor_name.decode("ascii")
module = module.decode("ascii")
actor_method_names = json.loads(actor_method_names.decode("ascii"))