[rllib] Allow development without needing to compile Ray (#3623)

* wip

* lint

* wip

* wip

* rename

* wip

* Cleaner handling of cli prompt
This commit is contained in:
Eric Liang 2018-12-24 18:08:23 +09:00 committed by GitHub
parent c13b2685f5
commit 9f63119a83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 4 deletions

View file

@ -17,10 +17,6 @@ Trying snapshots from master
Here are links to the latest wheels (which are built off of master). To install these wheels, run the following command:
.. danger::
These versions will have newer features but are subject to more bugs. If you encounter crashes or other instabilities, please revert to the latest stable version.
.. code-block:: bash
pip install -U [link to wheel]

View file

@ -1,6 +1,11 @@
RLlib Development
=================
Development Install
-------------------
You can develop RLlib locally without needing to compile Ray by using the `setup-rllib-dev.py <https://github.com/ray-project/ray/blob/master/python/ray/rllib/setup-rllib-dev.py>`__ script. This sets up links between the ``rllib`` dir in your git repo and the one bundled with the ``ray`` package. When using this script, make sure that your git branch is in sync with the installed Ray binaries (i.e., you are up-to-date on `master <https://github.com/ray-project/ray>`__ and have the latest `wheel <https://ray.readthedocs.io/en/latest/installation.html>`__ installed.)
Features
--------

View file

@ -85,6 +85,7 @@ Models and Preprocessors
RLlib Development
-----------------
* `Development Install <rllib-dev.html#development-install>`__
* `Features <rllib-dev.html#feature-development>`__
* `Benchmarks <rllib-dev.html#benchmarks>`__
* `Contributing Algorithms <rllib-dev.html#contributing-algorithms>`__

View file

@ -0,0 +1,38 @@
#!/usr/bin/env python
"""This script allows you to develop RLlib without needing to compile Ray."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import click
import os
import subprocess
import ray
if __name__ == "__main__":
rllib_home = os.path.abspath(os.path.join(ray.__file__, "../rllib"))
local_home = os.path.abspath(os.path.dirname(__file__))
assert os.path.isdir(rllib_home), rllib_home
assert os.path.isdir(local_home), local_home
click.confirm(
"This will replace:\n {}\nwith a symlink to:\n {}".format(
rllib_home, local_home),
abort=True)
if os.access(os.path.dirname(rllib_home), os.W_OK):
subprocess.check_call(["rm", "-rf", rllib_home])
subprocess.check_call(["ln", "-s", local_home, rllib_home])
else:
print("You don't have write permission to {}, using sudo:".format(
rllib_home))
subprocess.check_call(["sudo", "rm", "-rf", rllib_home])
subprocess.check_call(["sudo", "ln", "-s", local_home, rllib_home])
print("Created links.\n\nIf you run into issues initializing Ray, please "
"ensure that your local repo and the installed Ray is in sync "
"(pip install -U the latest wheels at "
"https://ray.readthedocs.io/en/latest/installation.html, "
"and ensure you are up-to-date on the master branch on git).\n\n"
"Note that you may need to delete the rllib symlink when pip "
"installing new Ray versions to prevent pip from overwriting files "
"in your git repo.")