mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
mock modules for readthedocs (#264)
This commit is contained in:
parent
80526f7777
commit
a5d8138f88
4 changed files with 12 additions and 7 deletions
|
@ -16,6 +16,12 @@ import sys
|
|||
import os
|
||||
import shlex
|
||||
|
||||
# These 4 lines added to enable ReadTheDocs to work.
|
||||
import mock
|
||||
MOCK_MODULES = ["libraylib", "IPython", "numpy", "typing", "funcsigs", "subprocess32", "protobuf", "colorama", "graphviz", "ray.internal.graph_pb2"]
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = mock.Mock()
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
|
|
@ -6,6 +6,7 @@ WORKER_MODE = 1
|
|||
SHELL_MODE = 2
|
||||
PYTHON_MODE = 3
|
||||
|
||||
import config
|
||||
import libraylib as lib
|
||||
import serialization
|
||||
from worker import scheduler_info, visualize_computation_graph, task_info, register_module, connect, disconnect, get, put, remote, kill_workers, restart_workers_local
|
||||
|
|
|
@ -5,7 +5,6 @@ import subprocess32 as subprocess
|
|||
|
||||
import ray
|
||||
import worker
|
||||
import ray.config as config
|
||||
|
||||
_services_env = os.environ.copy()
|
||||
_services_env["PATH"] = os.pathsep.join([os.path.dirname(os.path.abspath(__file__)), _services_env["PATH"]])
|
||||
|
@ -92,7 +91,7 @@ def start_scheduler(scheduler_address, local):
|
|||
process will be killed by serices.cleanup() when the Python process that
|
||||
imported services exits.
|
||||
"""
|
||||
p = subprocess.Popen(["scheduler", scheduler_address, "--log-file-name", config.get_log_file_path("scheduler.log")], env=_services_env)
|
||||
p = subprocess.Popen(["scheduler", scheduler_address, "--log-file-name", ray.config.get_log_file_path("scheduler.log")], env=_services_env)
|
||||
if local:
|
||||
all_processes.append((p, scheduler_address))
|
||||
|
||||
|
@ -107,7 +106,7 @@ def start_objstore(scheduler_address, objstore_address, local):
|
|||
process will be killed by serices.cleanup() when the Python process that
|
||||
imported services exits.
|
||||
"""
|
||||
p = subprocess.Popen(["objstore", scheduler_address, objstore_address, "--log-file-name", config.get_log_file_path("-".join(["objstore", objstore_address]) + ".log")], env=_services_env)
|
||||
p = subprocess.Popen(["objstore", scheduler_address, objstore_address, "--log-file-name", ray.config.get_log_file_path("-".join(["objstore", objstore_address]) + ".log")], env=_services_env)
|
||||
if local:
|
||||
all_processes.append((p, objstore_address))
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import numpy as np
|
|||
import colorama
|
||||
|
||||
import ray
|
||||
import ray.config as config
|
||||
import serialization
|
||||
import ray.internal.graph_pb2
|
||||
import ray.graph
|
||||
|
@ -313,7 +312,7 @@ def visualize_computation_graph(file_path=None, view=False, worker=global_worker
|
|||
"""
|
||||
|
||||
if file_path is None:
|
||||
file_path = config.get_log_file_path("computation-graph.pdf")
|
||||
file_path = ray.config.get_log_file_path("computation-graph.pdf")
|
||||
|
||||
base_path, extension = os.path.splitext(file_path)
|
||||
if extension != ".pdf":
|
||||
|
@ -369,8 +368,8 @@ def connect(scheduler_address, objstore_address, worker_address, is_driver=False
|
|||
worker.handle = ray.lib.create_worker(worker.scheduler_address, worker.objstore_address, worker.worker_address, is_driver)
|
||||
worker.set_mode(mode)
|
||||
FORMAT = "%(asctime)-15s %(message)s"
|
||||
logging.basicConfig(level=logging.DEBUG, format=FORMAT, filename=config.get_log_file_path("-".join(["worker", worker_address]) + ".log"))
|
||||
ray.lib.set_log_config(config.get_log_file_path("-".join(["worker", worker_address, "c++"]) + ".log"))
|
||||
logging.basicConfig(level=logging.DEBUG, format=FORMAT, filename=ray.config.get_log_file_path("-".join(["worker", worker_address]) + ".log"))
|
||||
ray.lib.set_log_config(ray.config.get_log_file_path("-".join(["worker", worker_address, "c++"]) + ".log"))
|
||||
|
||||
def disconnect(worker=global_worker):
|
||||
"""Disconnect this worker from the scheduler and object store."""
|
||||
|
|
Loading…
Add table
Reference in a new issue