[RLlib] Fix setup-dev.py error when creating a softlink for new_dashboard. (#12442)

This commit is contained in:
Sven Mika
2020-12-01 11:46:59 +01:00
committed by GitHub
parent 3ad9365e1d
commit 9021f15b2a
2 changed files with 21 additions and 9 deletions
+16 -7
View File
@@ -10,18 +10,25 @@ import subprocess
import ray
def do_link(package, force=False, local_path=""):
def do_link(package, force=False, local_path=None):
package_home = os.path.abspath(os.path.join(ray.__file__, f"../{package}"))
local_home = os.path.abspath(
os.path.join(__file__, local_path + f"../{package}"))
# Infer local_path automatically.
if local_path is None:
local_path = f"../{package}"
local_home = os.path.abspath(os.path.join(__file__, local_path))
# If installed package dir does not exist, continue either way. We'll
# remove it/create a link from there anyways.
if not os.path.isdir(package_home):
print(f"{package_home} does not exist. Continuing to link.")
assert os.path.isdir(local_home), local_home
# Make sure the path we are linking to does exist.
assert os.path.exists(local_home), local_home
# Confirm with user.
if not force and not click.confirm(
f"This will replace:\n {package_home}\nwith "
f"a symlink to:\n {local_home}",
default=True):
return
# Windows: Create directory junction.
if os.name == "nt":
try:
@@ -51,7 +58,7 @@ if __name__ == "__main__":
"--yes", "-y", action="store_true", help="Don't ask for confirmation.")
args = parser.parse_args()
do_link("rllib", force=args.yes, local_path="../../")
do_link("rllib", force=args.yes, local_path="../../../rllib")
do_link("tune", force=args.yes)
do_link("autoscaler", force=args.yes)
do_link("scripts", force=args.yes)
@@ -59,8 +66,10 @@ if __name__ == "__main__":
do_link("tests", force=args.yes)
do_link("experimental", force=args.yes)
do_link("util", force=args.yes)
do_link("dashboard", force=args.yes)
do_link("new_dashboard", force=args.yes)
# Link package's `new_dashboard` directly to local (repo's) dashboard.
# The repo's `new_dashboard` is a file, soft-linking to which will not work
# on Mac.
do_link("new_dashboard", force=args.yes, local_path="../../../dashboard")
print("Created links.\n\nIf you run into issues initializing Ray, please "
"ensure that your local repo and the installed Ray are in sync "
"(pip install -U the latest wheels at "
+5 -2
View File
@@ -887,6 +887,9 @@ class EntropyCoeffSchedule:
@override(Policy)
def on_global_var_update(self, global_vars):
super(EntropyCoeffSchedule, self).on_global_var_update(global_vars)
self.entropy_coeff.load(
op_or_none = self.entropy_coeff.assign(
self.entropy_coeff_schedule.value(global_vars["timestep"]),
session=self._sess)
read_value=False, # return tf op (None in eager mode).
)
if self._sess is not None:
self._sess.run(op_or_none)