mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 20:22:39 +08:00
Move setproctitle to ray[debug] package (#3415)
This commit is contained in:
committed by
Robert Nishihara
parent
20b8b1d891
commit
0d56fc10cc
@@ -10,7 +10,7 @@ You can install the latest stable version of Ray as follows.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install -U ray
|
||||
pip install -U ray # also recommended: ray[debug]
|
||||
|
||||
Trying snapshots from master
|
||||
----------------------------
|
||||
|
||||
@@ -15,7 +15,7 @@ RLlib has extra dependencies on top of ``ray``. First, you'll need to install ei
|
||||
.. code-block:: bash
|
||||
|
||||
pip install tensorflow # or tensorflow-gpu
|
||||
pip install ray[rllib]
|
||||
pip install ray[rllib] # also recommended: ray[debug]
|
||||
|
||||
You might also want to clone the `Ray repo <https://github.com/ray-project/ray>`__ for convenient access to RLlib helper scripts:
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ You'll need to first `install ray <installation.html>`__ to import Tune.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install ray
|
||||
pip install ray # also recommended: ray[debug]
|
||||
|
||||
|
||||
Quick Start
|
||||
|
||||
@@ -56,8 +56,9 @@ class MemoryMonitor(object):
|
||||
if not psutil:
|
||||
logger.warning(
|
||||
"WARNING: Not monitoring node memory since `psutil` is not "
|
||||
"installed. Install this with `pip install psutil` to enable "
|
||||
"debugging of memory-related crashes.")
|
||||
"installed. Install this with `pip install psutil` "
|
||||
"(or ray[debug]) to enable debugging of memory-related "
|
||||
"crashes.")
|
||||
|
||||
def raise_if_low_memory(self):
|
||||
if not psutil:
|
||||
|
||||
@@ -651,7 +651,7 @@ def stack():
|
||||
COMMAND = """
|
||||
pyspy=`which py-spy`
|
||||
if [ ! -e "$pyspy" ]; then
|
||||
echo "ERROR: Please 'pip install py-spy' first"
|
||||
echo "ERROR: Please 'pip install py-spy' (or ray[debug]) first"
|
||||
exit 1
|
||||
fi
|
||||
# Set IFS to iterate over lines instead of over words.
|
||||
|
||||
@@ -236,7 +236,8 @@ class TrialRunner(object):
|
||||
return "Memory usage on this node: {}/{} GB{}".format(
|
||||
round(used_gb, 1), round(total_gb, 1), warn)
|
||||
except ImportError:
|
||||
return "Unknown memory usage (`pip install psutil` to resolve)"
|
||||
return ("Unknown memory usage. Please run `pip install psutil` "
|
||||
"(or ray[debug]) to resolve)")
|
||||
|
||||
def has_resources(self, resources):
|
||||
"""Returns whether this runner has at least the specified resources."""
|
||||
|
||||
+15
-4
@@ -12,7 +12,6 @@ import logging
|
||||
import numpy as np
|
||||
import os
|
||||
import redis
|
||||
import setproctitle
|
||||
import signal
|
||||
import sys
|
||||
import threading
|
||||
@@ -73,6 +72,15 @@ DEFAULT_ACTOR_CREATION_CPUS_SPECIFIED_CASE = 1
|
||||
# using logging.basicConfig in its entry/init points.
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
import setproctitle
|
||||
except ImportError:
|
||||
setproctitle = None
|
||||
logger.warning(
|
||||
"WARNING: Not updating worker name since `setproctitle` is not "
|
||||
"installed. Install this with `pip install setproctitle` "
|
||||
"(or ray[debug]) to enable monitoring of worker processes.")
|
||||
|
||||
|
||||
class RayTaskError(Exception):
|
||||
"""An object used internally to represent a task that threw an exception.
|
||||
@@ -1916,7 +1924,8 @@ def connect(info,
|
||||
# Initialize some fields.
|
||||
if mode is WORKER_MODE:
|
||||
worker.worker_id = random_string()
|
||||
setproctitle.setproctitle("ray_worker")
|
||||
if setproctitle:
|
||||
setproctitle.setproctitle("ray_worker")
|
||||
else:
|
||||
# This is the code path of driver mode.
|
||||
if driver_id is None:
|
||||
@@ -2163,9 +2172,11 @@ def disconnect(worker=global_worker):
|
||||
|
||||
@contextmanager
|
||||
def _changeproctitle(title, next_title):
|
||||
setproctitle.setproctitle(title)
|
||||
if setproctitle:
|
||||
setproctitle.setproctitle(title)
|
||||
yield
|
||||
setproctitle.setproctitle(next_title)
|
||||
if setproctitle:
|
||||
setproctitle.setproctitle(next_title)
|
||||
|
||||
|
||||
def _try_to_compute_deterministic_class_id(cls, depth=5):
|
||||
|
||||
+4
-2
@@ -64,7 +64,10 @@ else:
|
||||
|
||||
optional_ray_files += ray_autoscaler_files
|
||||
|
||||
extras = {"rllib": ["pyyaml", "gym[atari]", "opencv-python", "lz4", "scipy"]}
|
||||
extras = {
|
||||
"rllib": ["pyyaml", "gym[atari]", "opencv-python", "lz4", "scipy"],
|
||||
"debug": ["psutil", "setproctitle", "py-spy"],
|
||||
}
|
||||
|
||||
|
||||
class build_ext(_build_ext.build_ext):
|
||||
@@ -139,7 +142,6 @@ requires = [
|
||||
"pytest",
|
||||
"pyyaml",
|
||||
"redis",
|
||||
"setproctitle",
|
||||
# The six module is required by pyarrow.
|
||||
"six >= 1.0.0",
|
||||
"flatbuffers",
|
||||
|
||||
Reference in New Issue
Block a user