Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/tune.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions python/ray/memory_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ def __init__(self, error_threshold=0.95, check_interval=1):
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:
Expand Down
2 changes: 1 addition & 1 deletion python/ray/scripts/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion python/ray/tune/trial_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def _memory_debug_string(self):
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."""
Expand Down
19 changes: 15 additions & 4 deletions python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import numpy as np
import os
import redis
import setproctitle
import signal
import sys
import threading
Expand Down Expand Up @@ -73,6 +72,15 @@
# using logging.basicConfig in its entry/init points.
logger = logging.getLogger(__name__)

try:
import setproctitle
except ImportError:
setproctitle = None
logger.warning(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a bit verbose if you have a lot of workers, but it is by intention.

"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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 4 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@

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):
Expand Down Expand Up @@ -139,7 +142,6 @@ def find_version(*filepath):
"pytest",
"pyyaml",
"redis",
"setproctitle",
# The six module is required by pyarrow.
"six >= 1.0.0",
"flatbuffers",
Expand Down