Skip to content

Commit 1aafd5b

Browse files
committed
Merge branch 'master' into imitationlearning
* master: Add some development tips to documentation. (ray-project#1426) Add link to github from documentation. (ray-project#1425) [rllib] Update docs with api and components overview figures (ray-project#1443) Multiagent model using concatenated observations (ray-project#1416) Load evaluation configuration from checkpoint (ray-project#1392) [autoscaling] increase connect timeout, boto retries, and check subnet conf (ray-project#1422) Update wheel in autoscaler example. (ray-project#1408) [autoscaler] Fix ValueError: Missing required config keyavailability_zoneof type str [tune][minor] Fixes (ray-project#1383) [rllib] Expose PPO evaluator resource requirements (ray-project#1391) fix autoscaler test (ray-project#1411) [rllib] Fix incorrect documentation on how to use custom models ray-project#1405 Added option for availability zone (ray-project#1393) Adding all DataFrame methods with NotImplementedErrors (ray-project#1403) Remove pyarrow version check. (ray-project#1394) # Conflicts: # python/ray/rllib/eval.py
2 parents 8c18695 + d7dfb16 commit 1aafd5b

39 files changed

+3007
-156
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ popd
3232
bash "$ROOT_DIR/src/thirdparty/download_thirdparty.sh"
3333
bash "$ROOT_DIR/src/thirdparty/build_thirdparty.sh" $PYTHON_EXECUTABLE
3434

35-
# Now build everything.
35+
# Now we build everything.
3636
pushd "$ROOT_DIR/python/ray/core"
3737
# We use these variables to set PKG_CONFIG_PATH, which is important so that
3838
# in cmake, pkg-config can find plasma.

doc/source/autoscaling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Autoscaling
4141

4242
Ray clusters come with a load-based auto-scaler. When cluster resource usage exceeds a configurable threshold (80% by default), new nodes will be launched up the specified ``max_workers`` limit. When nodes are idle for more than a timeout, they will be removed, down to the ``min_workers`` limit. The head node is never removed.
4343

44-
The default idle timeout is 5 minutes. This is because in AWS there is a minimum billing charge of 5 minutes per instance, after which usage is billed by the second.
44+
The default idle timeout is 5 minutes. This is to prevent excessive node churn which could impact performance and increase costs (in AWS there is a minimum billing charge of 1 minute per instance, after which usage is billed by the second).
4545

4646
Monitoring cluster status
4747
-------------------------

doc/source/development.rst

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Development Tips
2+
================
3+
4+
If you are doing development on the Ray codebase, the following tips may be
5+
helpful.
6+
7+
1. **Speeding up compilation:** Be sure to install Ray with
8+
9+
.. code-block:: shell
10+
11+
cd ray/python
12+
python setup.py develop
13+
14+
(as opposed to ``python setup.py install``). When you do the "install"
15+
version, files will be copied from the Ray directory to a directory of Python
16+
packages (often something like
17+
``/home/ubuntu/anaconda3/lib/python3.6/site-packages/ray``). This means that
18+
changes you make to files in the Ray directory will not have any effect.
19+
However, when you run the "develop" version, no files will be copied and so
20+
any changes you make to Python files will immediately take effect without
21+
rerunning ``setup.py``.
22+
23+
If you run into **Permission Denied** errors when running ``setup.py``, you
24+
can try doing ``python setup.py develop --user``. You may also need to run
25+
something like ``sudo chown -R $USER /home/ubuntu/anaconda3`` (substituting
26+
in the appropriate path).
27+
28+
If you make changes to the C++ files, you will need to recompile them.
29+
However, you do not need to rerun ``setup.py``. Instead, you can recompile
30+
much more quickly by doing
31+
32+
.. code-block:: shell
33+
34+
cd ray/python/ray/core
35+
make -j8
36+
37+
2. **Starting processes in a debugger:** When processes are crashing, it is
38+
often useful to start them in a debugger (``gdb`` on Linux or ``lldb`` on
39+
MacOS). See the latest discussion about how to do this `here`_.
40+
41+
3. **Running tests locally:** Suppose that one of the tests (e.g.,
42+
``runtest.py``) is failing. You can run that test locally by running
43+
``python test/runtest.py``. However, doing so will run all of the tests which
44+
can take a while. To run a specific test that is failing, you can do
45+
46+
.. code-block:: shell
47+
48+
cd ray
49+
python test/runtest.py APITest.testKeywordArgs
50+
51+
When running tests, usually only the first test failure matters. A single
52+
test failure often triggers the failure of subsequent tests in the same
53+
script.
54+
55+
4. **Running linter locally:** To run the Python linter on a specific file, run
56+
something like ``flake8 ray/python/ray/worker.py``. You may need to first run
57+
``pip install flake8``.
58+
59+
5. **Inspecting Redis shards by hand:** To inspect the primary Redis shard by
60+
hand, you can query it with commands like the following.
61+
62+
.. code-block:: python
63+
64+
r_primary = ray.worker.global_worker.redis_client
65+
r_primary.keys("*")
66+
67+
To inspect other Redis shards, you will need to create a new Redis client.
68+
For example (assuming the relevant IP address is ``127.0.0.1`` and the
69+
relevant port is ``1234``), you can do this as follows.
70+
71+
.. code-block:: python
72+
73+
import redis
74+
r = redis.StrictRedis(host='127.0.0.1', port=1234)
75+
76+
You can find a list of the relevant IP addresses and ports by running
77+
78+
.. code-block:: python
79+
80+
r_primary.lrange('RedisShards', 0, -1)
81+
82+
.. _`here`: https://github.com/ray-project/ray/issues/108

doc/source/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
Ray
22
===
33

4+
.. raw:: html
5+
6+
<embed>
7+
<a href="https://github.com/ray-project/ray"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://assets-git-camo.f3mw1.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
8+
</embed>
9+
410
*Ray is a flexible, high-performance distributed execution framework.*
511

12+
View the `codebase on GitHub`_.
13+
14+
.. _`codebase on GitHub`: https://github.com/ray-project/ray
15+
616
Ray comes with libraries that accelerate deep learning and reinforcement learning development:
717

818
- `Ray.tune`_: Hyperparameter Optimization Framework
@@ -95,4 +105,5 @@ Example Program
95105
:caption: Help
96106

97107
troubleshooting.rst
108+
development.rst
98109
contact.rst

doc/source/rllib-api.svg

Lines changed: 4 additions & 0 deletions
Loading

doc/source/rllib-components.svg

Lines changed: 4 additions & 0 deletions
Loading

doc/source/rllib-dev.rst

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,23 @@ Recipe for an RLlib algorithm
1010

1111
Here are the steps for implementing a new algorithm in RLlib:
1212

13-
1. Define an algorithm-specific `Evaluator class <#evaluators-and-optimizers>`__ (the core of the algorithm). Evaluators encapsulate framework-specific components such as the policy and loss functions. For an example, see the `A3C Evaluator implementation <https://github.com/ray-project/ray/blob/master/python/ray/rllib/a3c/a3c_evaluator.py>`__.
13+
1. Define an algorithm-specific `Policy evaluator class <#policy-evaluators-and-optimizers>`__ (the core of the algorithm). Evaluators encapsulate framework-specific components such as the policy and loss functions. For an example, see the `A3C Evaluator implementation <https://github.com/ray-project/ray/blob/master/python/ray/rllib/a3c/a3c_evaluator.py>`__.
1414

1515

16-
2. Pick an appropriate `RLlib optimizer class <#evaluators-and-optimizers>`__. Optimizers manage the parallel execution of the algorithm. RLlib provides several built-in optimizers for gradient-based algorithms. Advanced algorithms may find it beneficial to implement their own optimizers.
16+
2. Pick an appropriate `Policy optimizer class <#policy-evaluators-and-optimizers>`__. Optimizers manage the parallel execution of the algorithm. RLlib provides several built-in optimizers for gradient-based algorithms. Advanced algorithms may find it beneficial to implement their own optimizers.
1717

1818

1919
3. Wrap the two up in an `Agent class <#agents>`__. Agents are the user-facing API of RLlib. They provide the necessary "glue" and implement accessory functionality such as statistics reporting and checkpointing.
2020

2121
To help with implementation, RLlib provides common action distributions, preprocessors, and neural network models, found in `catalog.py <https://github.com/ray-project/ray/blob/master/python/ray/rllib/models/catalog.py>`__, which are shared by all algorithms. Note that most of these utilities are currently Tensorflow specific.
2222

23-
Defining a custom model
24-
-----------------------
25-
26-
Often you will want to plug in your own neural network into an existing RLlib algorithm.
27-
This can be easily done by defining your own `Model class <#models-and-preprocessors>`__ and registering it in the RLlib catalog, after which it will be available for use by all RLlib algorithms.
28-
29-
An example usage of a custom model looks like this:
30-
31-
::
32-
33-
from ray.rllib.models import ModelCatalog, Model
34-
35-
class MyModelClass(Model):
36-
def _init(self, inputs, num_outputs, options):
37-
layer1 = slim.fully_connected(inputs, 64, ...)
38-
layer2 = slim.fully_connected(inputs, 64, ...)
39-
...
40-
return layerN, layerN_minus_1
41-
42-
ModelCatalog.register_custom_model("my_model", MyModelClass)
43-
44-
alg = ppo.PPOAgent(env="CartPole-v0", config={
45-
"custom_model": "my_model",
46-
})
47-
48-
49-
Note that if you need to reference large data objects as part of the computation, e.g. weights, you can put them into the Ray object store with ``ray.put`` and then retrieve them from inside your model class.
23+
.. image:: rllib-api.svg
5024

5125

5226
The Developer API
5327
-----------------
5428

55-
The following APIs are the building blocks of RLlib algorithms. Note that they are not yet considered stable.
29+
The following APIs are the building blocks of RLlib algorithms (also take a look at the `user components overview <rllib.html#components-user-customizable-and-internal>`__).
5630

5731
Agents
5832
~~~~~~
@@ -65,8 +39,8 @@ a common base class:
6539
.. autoclass:: ray.rllib.agent.Agent
6640
:members:
6741

68-
Evaluators and Optimizers
69-
~~~~~~~~~~~~~~~~~~~~~~~~~
42+
Policy Evaluators and Optimizers
43+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7044

7145
.. autoclass:: ray.rllib.optimizers.evaluator.Evaluator
7246
:members:
@@ -123,7 +97,7 @@ Currently we support the following action distributions:
12397
The Model Catalog
12498
~~~~~~~~~~~~~~~~~
12599

126-
The Model Catalog is the mechanism for algorithms to get preprocessors, models, and action distributions for varying gym environments. It enables sharing of these components across different algorithms.
100+
The Model Catalog is the mechanism for algorithms to get canonical preprocessors, models, and action distributions for varying gym environments. It enables easy reuse of these components across different algorithms.
127101

128102
.. autoclass:: ray.rllib.models.ModelCatalog
129103
:members:

0 commit comments

Comments
 (0)