Skip to content

Commit

Permalink
Allow Ray to be built without UI by setting INCLUDE_UI=0. (ray-projec…
Browse files Browse the repository at this point in the history
…t#1094)

* Allow building Ray without UI by setting INCLUDE_UI=0.

* Fix bash.

* Fix linting.
  • Loading branch information
robertnishihara authored and pcmoritz committed Oct 10, 2017
1 parent 3944e9a commit 8f1a73f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,23 @@
"ray/core/src/local_scheduler/local_scheduler",
"ray/core/src/local_scheduler/liblocal_scheduler_library.so",
"ray/core/src/global_scheduler/global_scheduler",
"ray/core/src/catapult_files/index.html",
"ray/core/src/catapult_files/trace_viewer_full.html",
"ray/WebUI.ipynb"
]

optional_ray_files = []

ray_ui_files = [
"ray/core/src/catapult_files/index.html",
"ray/core/src/catapult_files/trace_viewer_full.html"
]

# The UI files are mandatory if the INCLUDE_UI environment variable equals 1.
# Otherwise, they are optional.
if "INCLUDE_UI" in os.environ and os.environ["INCLUDE_UI"] == "1":
ray_files += ray_ui_files
else:
optional_ray_files += ray_ui_files


class build_ext(_build_ext.build_ext):
def run(self):
Expand Down Expand Up @@ -56,6 +68,14 @@ def run(self):
self.move_file(os.path.join(generated_python_directory,
filename))

# Try to copy over the optional files.
for filename in optional_ray_files:
try:
self.move_file(filename)
except Exception as e:
print("Failed to copy optional file {}. This is ok."
.format(filename))

def move_file(self, filename):
# TODO(rkn): This feels very brittle. It may not handle all cases. See
# https://github.com/apache/arrow/blob/master/python/setup.py for an
Expand Down
2 changes: 1 addition & 1 deletion src/thirdparty/build_ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CATAPULT_FILES=$TP_DIR/../../python/ray/core/src/catapult_files
# This is where we will copy the files that need to be packaged with the wheels.
mkdir -p $CATAPULT_FILES

if [ ! type python2 > /dev/null ]; then
if ! type python2 > /dev/null; then
echo "cannot properly set up UI without a python2 executable"
if [[ "$INCLUDE_UI" == "1" ]]; then
# Since the UI is explicitly supposed to be included, fail here.
Expand Down

0 comments on commit 8f1a73f

Please sign in to comment.