Skip to content

Commit

Permalink
Only install ray python packages. (ray-project#330)
Browse files Browse the repository at this point in the history
* Only install ray python packages.

* Add some __init__.py files.

* Install Ray before building documentation.

* Fix install-ray.sh.

* Fix.
  • Loading branch information
robertnishihara authored and pcmoritz committed Mar 2, 2017
1 parent 39b7abe commit 6a4bde5
Show file tree
Hide file tree
Showing 39 changed files with 79 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The build output should clearly not be checked in
/python/core
/python/ray/core
/src/common/thirdparty/redis
/numbuf/thirdparty/arrow

Expand Down
44 changes: 22 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ matrix:
install: []
script:
- .travis/check-git-clang-format-output.sh
# Try generating Sphinx documentation. To do this, we need to setup some
# Python stuff.
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
# Try generating Sphinx documentation. To do this, we need to install
# Ray first.
- ./.travis/install-dependencies.sh
- ./.travis/install-ray.sh
- export PATH="$HOME/miniconda/bin:$PATH"
- cd doc
- pip install -r requirements-doc.txt
Expand All @@ -46,39 +46,39 @@ matrix:
- ./.travis/install-dependencies.sh
- ./.travis/install-ray.sh

- cd python/core
- bash ../../src/common/test/run_valgrind.sh
- bash ../../src/plasma/test/run_valgrind.sh
- bash ../../src/local_scheduler/test/run_valgrind.sh
- cd ../..
- cd python/ray/core
- bash ../../../src/common/test/run_valgrind.sh
- bash ../../../src/plasma/test/run_valgrind.sh
- bash ../../../src/local_scheduler/test/run_valgrind.sh
- cd ../../..

script:
- python ./python/plasma/test/test.py valgrind
- python ./python/local_scheduler/test/test.py valgrind
- python ./python/global_scheduler/test/test.py valgrind
- python ./python/ray/plasma/test/test.py valgrind
- python ./python/ray/local_scheduler/test/test.py valgrind
- python ./python/ray/global_scheduler/test/test.py valgrind

install:
- ./.travis/install-dependencies.sh
- ./.travis/install-ray.sh

- if [[ "$PYTHON" == "3.5" ]]; then export PATH="$HOME/miniconda/bin:$PATH"; fi

- cd python/core
- bash ../../src/common/test/run_tests.sh
- bash ../../src/plasma/test/run_tests.sh
- bash ../../src/local_scheduler/test/run_tests.sh
- cd ../..
- cd python/ray/core
- bash ../../../src/common/test/run_tests.sh
- bash ../../../src/plasma/test/run_tests.sh
- bash ../../../src/local_scheduler/test/run_tests.sh
- cd ../../..

script:
- if [[ "$PYTHON" == "3.5" ]]; then export PATH="$HOME/miniconda/bin:$PATH"; fi

- python src/numbuf/python/test/runtest.py

- python python/common/test/test.py
- python python/common/redis_module/runtest.py
- python python/plasma/test/test.py
- python python/local_scheduler/test/test.py
- python python/global_scheduler/test/test.py
- python python/ray/common/test/test.py
- python python/ray/common/redis_module/runtest.py
- python python/ray/plasma/test/test.py
- python python/ray/local_scheduler/test/test.py
- python python/ray/global_scheduler/test/test.py

- python test/runtest.py
- python test/array_test.py
Expand Down
8 changes: 8 additions & 0 deletions .travis/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ elif [[ "$PYTHON" == "3.5" ]] && [[ "$platform" == "macosx" ]]; then
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
pip install numpy cloudpickle funcsigs colorama psutil redis tensorflow
elif [[ "$LINT" == "1" ]]; then
sudo apt-get update
sudo apt-get install -y cmake build-essential autoconf curl libtool libboost-all-dev unzip
# Install miniconda.
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
pip install numpy cloudpickle funcsigs colorama psutil redis
else
echo "Unrecognized environment."
exit 1
Expand Down
7 changes: 7 additions & 0 deletions .travis/install-ray.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ elif [[ "$PYTHON" == "3.5" ]]; then
python setup.py install --user
popd

elif [[ "$LINT" == "1" ]]; then
export PATH="$HOME/miniconda/bin:$PATH"

pushd "$ROOT_DIR/../python"
python setup.py install --user
popd

else
echo "Unrecognized Python version."
exit 1
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ bash "$ROOT_DIR/src/numbuf/thirdparty/download_thirdparty.sh"
bash "$ROOT_DIR/src/numbuf/thirdparty/build_thirdparty.sh"

# Now build everything.
pushd "$ROOT_DIR/python/core"
cmake -DCMAKE_BUILD_TYPE=Release ../..
pushd "$ROOT_DIR/python/ray/core"
cmake -DCMAKE_BUILD_TYPE=Release ../../..
make clean
make
popd
1 change: 1 addition & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ray Documentation

To compile the documentation, run the following commands from this directory.
Note that Ray must be installed first.

```
pip install -r requirements-doc.txt
Expand Down
6 changes: 0 additions & 6 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
import os
import shlex

# These lines added to enable Sphinx to work without installing Ray.
import mock
MOCK_MODULES = ["global_scheduler", "numbuf", "local_scheduler", "plasma"]
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.
Expand Down
2 changes: 1 addition & 1 deletion python/ray/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import inspect
import json
import numpy as np
import local_scheduler
import random
import traceback

import ray.local_scheduler as local_scheduler
import ray.pickling as pickling
import ray.worker
import ray.experimental.state as state
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
import redis
import ray.services

# Check if the redis-server binary is present.
redis_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../../core/src/common/thirdparty/redis/src/redis-server")
if not os.path.exists(redis_path):
raise Exception("You do not have the redis-server binary. Run `make test` in the plasma directory to get it.")

# Absolute path of the ray redis module.
module_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../../core/src/common/redis_module/libray_redis_module.so")
print("path to the redis module is {}".format(module_path))

OBJECT_INFO_PREFIX = "OI:"
OBJECT_LOCATION_PREFIX = "OL:"
OBJECT_SUBSCRIBE_PREFIX = "OS:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import unittest

import local_scheduler
import ray.local_scheduler as local_scheduler

ID_SIZE = 20

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import time
import unittest

import global_scheduler
import local_scheduler
import plasma
from plasma.utils import random_object_id, generate_metadata, write_to_data_buffer, create_object_with_id, create_object
import ray.global_scheduler as global_scheduler
import ray.local_scheduler as local_scheduler
import ray.plasma as plasma
from ray.plasma.utils import random_object_id, generate_metadata, write_to_data_buffer, create_object_with_id, create_object

from ray import services

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
from __future__ import division
from __future__ import print_function

from core.src.local_scheduler.liblocal_scheduler_library import *
from ray.core.src.local_scheduler.liblocal_scheduler_library import *
from .local_scheduler_services import *
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import time
import unittest

import local_scheduler
import plasma
import ray.local_scheduler as local_scheduler
import ray.plasma as plasma

USE_VALGRIND = False
ID_SIZE = 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

try:
from core.src.numbuf.libnumbuf import *
from ray.core.src.numbuf.libnumbuf import *
except ImportError as e:
if hasattr(e, "msg") and isinstance(e.msg, str) and ("libstdc++" in e.msg or "CXX" in e.msg):
# This code path should be taken with Python 3.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from __future__ import division
from __future__ import print_function

from plasma.plasma import *
from ray.plasma.plasma import *
6 changes: 3 additions & 3 deletions python/plasma/plasma.py → python/ray/plasma/plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import sys
import time

import core.src.plasma.libplasma as libplasma
from core.src.plasma.libplasma import plasma_object_exists_error
from core.src.plasma.libplasma import plasma_out_of_memory_error
import ray.core.src.plasma.libplasma as libplasma
from ray.core.src.plasma.libplasma import plasma_object_exists_error
from ray.core.src.plasma.libplasma import plasma_out_of_memory_error

PLASMA_ID_SIZE = 20
PLASMA_WAIT_TIMEOUT = 2 ** 30
Expand Down
4 changes: 2 additions & 2 deletions python/plasma/test/test.py → python/ray/plasma/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import time
import unittest

import plasma
from plasma.utils import random_object_id, generate_metadata, write_to_data_buffer, create_object_with_id, create_object
import ray.plasma as plasma
from ray.plasma.utils import random_object_id, generate_metadata, write_to_data_buffer, create_object_with_id, create_object
from ray import services

USE_VALGRIND = False
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion python/ray/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import print_function

import numpy as np
import numbuf

import ray.numbuf as numbuf
import ray.pickling as pickling

def check_serializable(cls):
Expand Down
10 changes: 5 additions & 5 deletions python/ray/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import threading

# Ray modules
import local_scheduler
import plasma
import global_scheduler
import ray.local_scheduler as local_scheduler
import ray.plasma as plasma
import ray.global_scheduler as global_scheduler

PROCESS_TYPE_WORKER = "worker"
PROCESS_TYPE_LOCAL_SCHEDULER = "local_scheduler"
Expand Down Expand Up @@ -217,8 +217,8 @@ def start_redis(port=None, num_retries=20, stdout_file=None, stderr_file=None,
Raises:
Exception: An exception is raised if Redis could not be started.
"""
redis_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../core/src/common/thirdparty/redis/src/redis-server")
redis_module = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../core/src/common/redis_module/libray_redis_module.so")
redis_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "./core/src/common/thirdparty/redis/src/redis-server")
redis_module = os.path.join(os.path.dirname(os.path.abspath(__file__)), "./core/src/common/redis_module/libray_redis_module.so")
assert os.path.isfile(redis_filepath)
assert os.path.isfile(redis_module)
counter = 0
Expand Down
6 changes: 3 additions & 3 deletions python/ray/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import ray.pickling as pickling
import ray.serialization as serialization
import ray.services as services
import numbuf
import local_scheduler
import plasma
import ray.numbuf as numbuf
import ray.local_scheduler as local_scheduler
import ray.plasma as plasma

SCRIPT_MODE = 0
WORKER_MODE = 1
Expand Down
2 changes: 1 addition & 1 deletion python/ray/workers/default_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def random_string():
error_explanation = """
This error is unexpected and should not have happened. Somehow a worker crashed
in an unanticipated way causing the main_loop to throw an exception, which is
being caught in "lib/python/ray/workers/default_worker.py".
being caught in "python/ray/workers/default_worker.py".
"""

while True:
Expand Down
20 changes: 10 additions & 10 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ def run(self):
setup(name="ray",
version="0.0.1",
packages=find_packages(),
package_data={"core": ["src/common/thirdparty/redis/src/redis-server",
"src/common/redis_module/libray_redis_module.so",
"src/plasma/plasma_store",
"src/plasma/plasma_manager",
"src/plasma/libplasma.so",
"src/local_scheduler/local_scheduler",
"src/local_scheduler/liblocal_scheduler_library.so",
"src/numbuf/libarrow.so",
"src/numbuf/libnumbuf.so",
"src/global_scheduler/global_scheduler"]},
package_data={"ray": ["core/src/common/thirdparty/redis/src/redis-server",
"core/src/common/redis_module/libray_redis_module.so",
"core/src/plasma/plasma_store",
"core/src/plasma/plasma_manager",
"core/src/plasma/libplasma.so",
"core/src/local_scheduler/local_scheduler",
"core/src/local_scheduler/liblocal_scheduler_library.so",
"core/src/numbuf/libarrow.so",
"core/src/numbuf/libnumbuf.so",
"core/src/global_scheduler/global_scheduler"]},
cmdclass={"install": install},
install_requires=["numpy",
"funcsigs",
Expand Down
2 changes: 1 addition & 1 deletion src/local_scheduler/test/local_scheduler_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ LocalSchedulerMock *LocalSchedulerMock_init(int num_workers,
UT_string *worker_command;
utstring_new(worker_command);
utstring_printf(worker_command,
"python ../../python/ray/workers/default_worker.py "
"python ../../../python/ray/workers/default_worker.py "
"--node-ip-address=%s --object-store-name=%s "
"--object-store-manager-name=%s --local-scheduler-name=%s "
"--redis-address=%s:%d",
Expand Down
2 changes: 1 addition & 1 deletion src/numbuf/python/test/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function

import unittest
import numbuf
import ray.numbuf as numbuf
import numpy as np
from numpy.testing import assert_equal
import os
Expand Down

0 comments on commit 6a4bde5

Please sign in to comment.