Allow Ray to be built without UI by setting INCLUDE_UI=0. (#1094)

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

* Fix bash.

* Fix linting.
This commit is contained in:
Robert Nishihara
2017-10-09 23:32:38 -07:00
committed by Philipp Moritz
parent 3944e9a450
commit 8f1a73f041
2 changed files with 23 additions and 3 deletions
+22 -2
View File
@@ -23,11 +23,23 @@ ray_files = [
"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):
@@ -56,6 +68,14 @@ class build_ext(_build_ext.build_ext):
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