[autoscaler] Autoscaler hangs forever on non-zero exit code command (#3969)

This commit is contained in:
Eric Liang
2019-02-06 17:25:24 -08:00
committed by Robert Nishihara
parent 49e9bec988
commit 04fc145a44
2 changed files with 228 additions and 205 deletions
+26 -16
View File
@@ -11,28 +11,38 @@ 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
def do_link(package):
package_home = os.path.abspath(
os.path.join(ray.__file__, "../{}".format(package)))
local_home = os.path.abspath(
os.path.join(__file__, "../../{}".format(package)))
assert os.path.isdir(package_home), package_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])
if not click.confirm(
"This will replace:\n {}\nwith a symlink to:\n {}".format(
package_home, local_home),
default=True):
return
if os.access(os.path.dirname(package_home), os.W_OK):
subprocess.check_call(["rm", "-rf", package_home])
subprocess.check_call(["ln", "-s", local_home, package_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])
package_home))
subprocess.check_call(["sudo", "rm", "-rf", package_home])
subprocess.check_call(["sudo", "ln", "-s", local_home, package_home])
if __name__ == "__main__":
do_link("rllib")
do_link("tune")
do_link("autoscaler")
print("Created links.\n\nIf you run into issues initializing Ray, please "
"ensure that your local repo and the installed Ray is in sync "
"ensure that your local repo and the installed Ray are 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 "
"Note that you may need to delete the package symlinks when pip "
"installing new Ray versions to prevent pip from overwriting files "
"in your git repo.")