2019-11-27 17:05:36 -08:00
|
|
|
from itertools import chain
|
2017-05-27 21:35:48 -07:00
|
|
|
import os
|
2018-11-05 05:53:55 +08:00
|
|
|
import re
|
2017-05-27 21:35:48 -07:00
|
|
|
import shutil
|
2016-10-31 17:08:03 -07:00
|
|
|
import subprocess
|
2017-07-31 21:04:15 -07:00
|
|
|
import sys
|
2016-02-22 17:35:03 -08:00
|
|
|
|
2017-05-27 21:35:48 -07:00
|
|
|
from setuptools import setup, find_packages, Distribution
|
|
|
|
import setuptools.command.build_ext as _build_ext
|
2016-02-07 15:50:02 -08:00
|
|
|
|
2017-08-07 21:17:28 -07:00
|
|
|
# Ideally, we could include these files by putting them in a
|
|
|
|
# MANIFEST.in or using the package_data argument to setup, but the
|
|
|
|
# MANIFEST.in gets applied at the very beginning when setup.py runs
|
|
|
|
# before these files have been created, so we have to move the files
|
|
|
|
# manually.
|
2018-06-02 07:28:27 +08:00
|
|
|
|
2020-04-21 09:53:08 -07:00
|
|
|
exe_suffix = ".exe" if sys.platform == "win32" else ""
|
|
|
|
|
|
|
|
# .pyd is the extension Python requires on Windows for shared libraries.
|
|
|
|
# https://docs.python.org/3/faq/windows.html#is-a-pyd-file-the-same-as-a-dll
|
|
|
|
pyd_suffix = ".pyd" if sys.platform == "win32" else ".so"
|
|
|
|
|
2019-04-02 22:17:33 -07:00
|
|
|
# NOTE: The lists below must be kept in sync with ray/BUILD.bazel.
|
2017-08-07 21:17:28 -07:00
|
|
|
ray_files = [
|
2018-10-26 13:36:58 -07:00
|
|
|
"ray/core/src/ray/thirdparty/redis/src/redis-server",
|
|
|
|
"ray/core/src/ray/gcs/redis_module/libray_redis_module.so",
|
2020-04-21 09:53:08 -07:00
|
|
|
"ray/core/src/plasma/plasma_store_server" + exe_suffix,
|
|
|
|
"ray/_raylet" + pyd_suffix,
|
|
|
|
"ray/core/src/ray/raylet/raylet_monitor" + exe_suffix,
|
|
|
|
"ray/core/src/ray/gcs/gcs_server" + exe_suffix,
|
|
|
|
"ray/core/src/ray/raylet/raylet" + exe_suffix,
|
2019-12-22 10:56:05 +08:00
|
|
|
"ray/streaming/_streaming.so",
|
2017-08-07 21:17:28 -07:00
|
|
|
]
|
2017-07-31 21:04:15 -07:00
|
|
|
|
2020-01-10 11:41:00 +08:00
|
|
|
build_java = os.getenv("RAY_INSTALL_JAVA") == "1"
|
|
|
|
if build_java:
|
|
|
|
ray_files.append("ray/jars/ray_dist.jar")
|
|
|
|
|
2019-07-08 22:41:37 +08:00
|
|
|
# These are the directories where automatically generated Python protobuf
|
2018-05-29 16:25:54 -07:00
|
|
|
# bindings are created.
|
|
|
|
generated_python_directories = [
|
2019-07-08 22:41:37 +08:00
|
|
|
"ray/core/generated",
|
2019-12-22 10:56:05 +08:00
|
|
|
"ray/streaming/generated",
|
2018-05-29 16:25:54 -07:00
|
|
|
]
|
|
|
|
|
2017-10-09 23:32:38 -07:00
|
|
|
optional_ray_files = []
|
|
|
|
|
2018-05-31 09:00:03 -07:00
|
|
|
ray_autoscaler_files = [
|
|
|
|
"ray/autoscaler/aws/example-full.yaml",
|
[autoscaler] Adding Azure Support (#7080)
* adding directory and node_provider entry for azure autoscaler
* adding initial cut at azure autoscaler functionality, needs testing and node_provider methods need updating
* adding todos and switching to auth file for service principal authentication
* adding role / scope to service principal
* resolving issues with app credentials
* adding retry for setting service principal role
* typo and adding retry to nic creation
* adding nsg to config, moving nic/public ip to node provider, cleanup node_provider, leaving in NodeProvider stub for testing
* linting
* updating cleanup and fixing bugs
* adding directory and node_provider entry for azure autoscaler
* adding initial cut at azure autoscaler functionality, needs testing and node_provider methods need updating
* adding todos and switching to auth file for service principal authentication
* adding role / scope to service principal
* resolving issues with app credentials
* adding retry for setting service principal role
* typo and adding retry to nic creation
* adding nsg to config, moving nic/public ip to node provider, cleanup node_provider, leaving in NodeProvider stub for testing
* linting
* updating cleanup and fixing bugs
* minor fixes
* first working version :)
* added tag support
* added msi identity intermediate
* enable MSI through user managed identity
* updated schema
* extend yaml schema
remove service principal code
add re-use of managed user identity
* fix rg_id
* fix logging
* replace manual cluster yaml validation with json schema
- improved error message
- support for intellisense in VSCode (or other IDEs)
* run linting
* updating yaml configs and formatting
* updating yaml configs and formatting
* typo in example config
* pulling default config from example-full
* resetting min, init worker prop
* adding docs for azure autoscaler and fixing status
* add azure to docs, fix config for spot instances, update azure provider to avoid caching issues during deployment
* fix for default subscription in azure node provider
* vm dev image build
* minor change
* keeping example-full.yaml in autoscaler/azure, updating azure example config
* linting azure config
* extending retries on azure config
* lint
* support for internal ips, fix to azure docs, and new azure gpu example config
* linting
* Update python/ray/autoscaler/azure/node_provider.py
Co-Authored-By: Richard Liaw <rliaw@berkeley.edu>
* revert_this
* remove_schema
* updating configs and removing ssh keygen, tweak azure node provider terminate
* minor tweaks
Co-authored-by: Markus Cozowicz <marcozo@microsoft.com>
Co-authored-by: Ubuntu <marcozo@mc-ray-jumpbox.chcbtljllnieveqhw3e4c1ducc.xx.internal.cloudapp.net>
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
2020-03-15 17:48:27 -04:00
|
|
|
"ray/autoscaler/azure/example-full.yaml",
|
2020-04-04 00:51:56 +02:00
|
|
|
"ray/autoscaler/azure/azure-vm-template.json",
|
|
|
|
"ray/autoscaler/azure/azure-config-template.json",
|
2018-05-31 09:00:03 -07:00
|
|
|
"ray/autoscaler/gcp/example-full.yaml",
|
2018-11-09 21:25:15 -08:00
|
|
|
"ray/autoscaler/local/example-full.yaml",
|
2019-10-03 10:17:00 -07:00
|
|
|
"ray/autoscaler/kubernetes/example-full.yaml",
|
|
|
|
"ray/autoscaler/kubernetes/kubectl-rsync.sh",
|
2020-03-11 17:53:21 +01:00
|
|
|
"ray/autoscaler/ray-schema.json"
|
2018-05-31 09:00:03 -07:00
|
|
|
]
|
2018-03-04 23:35:58 -08:00
|
|
|
|
2019-08-08 21:28:25 -07:00
|
|
|
ray_project_files = [
|
2019-09-16 19:58:54 -07:00
|
|
|
"ray/projects/schema.json", "ray/projects/templates/cluster_template.yaml",
|
|
|
|
"ray/projects/templates/project_template.yaml",
|
|
|
|
"ray/projects/templates/requirements.txt"
|
2019-08-08 21:28:25 -07:00
|
|
|
]
|
|
|
|
|
2019-09-23 08:50:40 -07:00
|
|
|
ray_dashboard_files = [
|
2020-01-17 20:53:53 -08:00
|
|
|
os.path.join(dirpath, filename)
|
|
|
|
for dirpath, dirnames, filenames in os.walk("ray/dashboard/client/build")
|
|
|
|
for filename in filenames
|
2019-09-23 08:50:40 -07:00
|
|
|
]
|
|
|
|
|
|
|
|
optional_ray_files += ray_autoscaler_files
|
|
|
|
optional_ray_files += ray_project_files
|
|
|
|
optional_ray_files += ray_dashboard_files
|
|
|
|
|
2018-03-07 10:18:58 -08:00
|
|
|
if "RAY_USE_NEW_GCS" in os.environ and os.environ["RAY_USE_NEW_GCS"] == "on":
|
2018-04-11 10:11:35 -07:00
|
|
|
ray_files += [
|
|
|
|
"ray/core/src/credis/build/src/libmember.so",
|
|
|
|
"ray/core/src/credis/build/src/libmaster.so",
|
|
|
|
"ray/core/src/credis/redis/src/redis-server"
|
|
|
|
]
|
2018-03-07 10:18:58 -08:00
|
|
|
|
2018-11-27 09:50:59 -08:00
|
|
|
extras = {
|
2020-02-05 14:16:58 -08:00
|
|
|
"debug": [],
|
2020-06-15 13:27:44 -07:00
|
|
|
"dashboard": ["requests", "gpustat"],
|
2020-05-06 17:44:02 -07:00
|
|
|
"serve": ["uvicorn", "flask", "blist"],
|
2020-03-24 20:30:12 -07:00
|
|
|
"tune": ["tabulate", "tensorboardX", "pandas"]
|
2018-11-27 09:50:59 -08:00
|
|
|
}
|
2017-12-12 13:58:28 -08:00
|
|
|
|
2020-01-19 01:49:33 -08:00
|
|
|
extras["rllib"] = extras["tune"] + [
|
2020-03-06 19:37:12 +01:00
|
|
|
"atari_py",
|
|
|
|
"dm_tree",
|
2020-01-19 01:49:33 -08:00
|
|
|
"gym[atari]",
|
|
|
|
"lz4",
|
2020-03-06 19:37:12 +01:00
|
|
|
"opencv-python-headless",
|
|
|
|
"pyyaml",
|
2020-01-19 01:49:33 -08:00
|
|
|
"scipy",
|
|
|
|
]
|
|
|
|
|
2020-02-25 10:33:33 +08:00
|
|
|
extras["streaming"] = ["msgpack >= 0.6.2"]
|
|
|
|
|
2019-11-27 17:05:36 -08:00
|
|
|
extras["all"] = list(set(chain.from_iterable(extras.values())))
|
|
|
|
|
2017-07-31 21:04:15 -07:00
|
|
|
|
2017-05-27 21:35:48 -07:00
|
|
|
class build_ext(_build_ext.build_ext):
|
2017-07-13 14:53:57 -07:00
|
|
|
def run(self):
|
2017-08-07 21:17:28 -07:00
|
|
|
# Note: We are passing in sys.executable so that we use the same
|
2020-02-19 19:01:26 -08:00
|
|
|
# version of Python to build packages inside the build.sh script. Note
|
2017-08-07 21:17:28 -07:00
|
|
|
# that certain flags will not be passed along such as --user or sudo.
|
|
|
|
# TODO(rkn): Fix this.
|
2019-03-07 09:59:13 +08:00
|
|
|
command = ["../build.sh", "-p", sys.executable]
|
2020-04-21 09:53:08 -07:00
|
|
|
if sys.platform == "win32" and command[0].lower().endswith(".sh"):
|
|
|
|
# We can't run .sh files directly in Windows, so find a shell.
|
|
|
|
# Don't use "bash" instead of "sh", because that might run the Bash
|
|
|
|
# from WSL! (We want MSYS2's Bash, which is also sh by default.)
|
|
|
|
shell = os.getenv("BAZEL_SH", "sh") # NOT "bash"! (see above)
|
|
|
|
command.insert(0, shell)
|
2020-01-10 11:41:00 +08:00
|
|
|
if build_java:
|
2019-03-07 09:59:13 +08:00
|
|
|
# Also build binaries for Java if the above env variable exists.
|
|
|
|
command += ["-l", "python,java"]
|
|
|
|
subprocess.check_call(command)
|
2017-08-07 21:17:28 -07:00
|
|
|
|
2019-11-10 18:12:18 -08:00
|
|
|
# We also need to install pickle5 along with Ray, so make sure that the
|
|
|
|
# relevant non-Python pickle5 files get copied.
|
2020-02-05 14:16:58 -08:00
|
|
|
pickle5_files = self.walk_directory("./ray/pickle5_files/pickle5")
|
|
|
|
|
|
|
|
thirdparty_files = self.walk_directory("./ray/thirdparty_files")
|
2019-11-10 18:12:18 -08:00
|
|
|
|
2020-02-19 19:01:26 -08:00
|
|
|
files_to_include = ray_files + pickle5_files + thirdparty_files
|
2017-07-31 21:04:15 -07:00
|
|
|
|
2019-07-08 22:41:37 +08:00
|
|
|
# Copy over the autogenerated protobuf Python bindings.
|
2018-05-29 16:25:54 -07:00
|
|
|
for directory in generated_python_directories:
|
|
|
|
for filename in os.listdir(directory):
|
|
|
|
if filename[-3:] == ".py":
|
|
|
|
files_to_include.append(os.path.join(directory, filename))
|
|
|
|
|
2017-07-13 14:53:57 -07:00
|
|
|
for filename in files_to_include:
|
|
|
|
self.move_file(filename)
|
2017-05-27 21:35:48 -07:00
|
|
|
|
2017-10-09 23:32:38 -07:00
|
|
|
# Try to copy over the optional files.
|
|
|
|
for filename in optional_ray_files:
|
|
|
|
try:
|
|
|
|
self.move_file(filename)
|
2018-10-24 16:30:00 -07:00
|
|
|
except Exception:
|
2017-10-09 23:32:38 -07:00
|
|
|
print("Failed to copy optional file {}. This is ok."
|
|
|
|
.format(filename))
|
|
|
|
|
2020-02-05 14:16:58 -08:00
|
|
|
def walk_directory(self, directory):
|
|
|
|
file_list = []
|
|
|
|
for (root, dirs, filenames) in os.walk(directory):
|
|
|
|
for name in filenames:
|
|
|
|
file_list.append(os.path.join(root, name))
|
|
|
|
return file_list
|
|
|
|
|
2017-07-13 14:53:57 -07:00
|
|
|
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
|
|
|
|
# example.
|
|
|
|
source = filename
|
|
|
|
destination = os.path.join(self.build_lib, filename)
|
|
|
|
# Create the target directory if it doesn't already exist.
|
2020-04-29 21:19:02 -07:00
|
|
|
os.makedirs(os.path.dirname(destination), exist_ok=True)
|
2019-02-23 11:58:59 -08:00
|
|
|
if not os.path.exists(destination):
|
|
|
|
print("Copying {} to {}.".format(source, destination))
|
2020-04-29 21:19:02 -07:00
|
|
|
if sys.platform == "win32":
|
|
|
|
# Does not preserve file mode (needed to avoid read-only bit)
|
|
|
|
shutil.copyfile(source, destination, follow_symlinks=True)
|
|
|
|
else:
|
|
|
|
# Preserves file mode (needed to copy executable bit)
|
|
|
|
shutil.copy(source, destination, follow_symlinks=True)
|
2017-05-27 21:35:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
class BinaryDistribution(Distribution):
|
2017-07-13 14:53:57 -07:00
|
|
|
def has_ext_modules(self):
|
|
|
|
return True
|
2017-05-27 21:35:48 -07:00
|
|
|
|
2017-03-21 12:57:54 -07:00
|
|
|
|
2018-11-05 05:53:55 +08:00
|
|
|
def find_version(*filepath):
|
|
|
|
# Extract version information from filepath
|
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
with open(os.path.join(here, *filepath)) as fp:
|
|
|
|
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
|
|
|
|
fp.read(), re.M)
|
|
|
|
if version_match:
|
|
|
|
return version_match.group(1)
|
|
|
|
raise RuntimeError("Unable to find version string.")
|
|
|
|
|
|
|
|
|
2018-11-22 11:43:52 -08:00
|
|
|
requires = [
|
2020-04-08 21:10:57 +08:00
|
|
|
"aiohttp",
|
2020-05-07 10:17:59 -07:00
|
|
|
"click >= 7.0",
|
2020-04-08 21:10:57 +08:00
|
|
|
"colorama",
|
|
|
|
"filelock",
|
|
|
|
"google",
|
|
|
|
"grpcio",
|
|
|
|
"jsonschema",
|
2020-06-01 20:00:36 -07:00
|
|
|
"msgpack >= 0.6.0, < 2.0.0",
|
2020-04-08 21:10:57 +08:00
|
|
|
"numpy >= 1.16",
|
|
|
|
"protobuf >= 3.8.0",
|
|
|
|
"py-spy >= 0.2.0",
|
|
|
|
"pyyaml",
|
2020-05-02 22:09:02 -07:00
|
|
|
"redis >= 3.3.2, < 3.5.0",
|
2018-11-22 11:43:52 -08:00
|
|
|
]
|
|
|
|
|
2018-04-11 10:11:35 -07:00
|
|
|
setup(
|
|
|
|
name="ray",
|
2018-11-05 05:53:55 +08:00
|
|
|
version=find_version("ray", "__init__.py"),
|
2018-12-19 18:41:09 -08:00
|
|
|
author="Ray Team",
|
|
|
|
author_email="ray-dev@googlegroups.com",
|
2018-10-28 19:49:52 -07:00
|
|
|
description=("A system for parallel and distributed Python that unifies "
|
|
|
|
"the ML ecosystem."),
|
|
|
|
long_description=open("../README.rst").read(),
|
|
|
|
url="https://github.com/ray-project/ray",
|
|
|
|
keywords=("ray distributed parallel machine-learning "
|
|
|
|
"reinforcement-learning deep-learning python"),
|
2018-04-11 10:11:35 -07:00
|
|
|
packages=find_packages(),
|
|
|
|
cmdclass={"build_ext": build_ext},
|
|
|
|
# The BinaryDistribution argument triggers build_ext.
|
|
|
|
distclass=BinaryDistribution,
|
2018-11-22 11:43:52 -08:00
|
|
|
install_requires=requires,
|
2020-04-03 21:10:34 -04:00
|
|
|
setup_requires=["cython >= 0.29.14", "wheel"],
|
2018-04-11 10:11:35 -07:00
|
|
|
extras_require=extras,
|
2018-07-12 19:12:04 +02:00
|
|
|
entry_points={
|
|
|
|
"console_scripts": [
|
|
|
|
"ray=ray.scripts.scripts:main",
|
2019-03-08 16:46:05 -08:00
|
|
|
"rllib=ray.rllib.scripts:cli [rllib]", "tune=ray.tune.scripts:cli"
|
2018-07-12 19:12:04 +02:00
|
|
|
]
|
|
|
|
},
|
2018-04-11 10:11:35 -07:00
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
|
|
|
license="Apache 2.0")
|