[RLlib] Fix test_env_with_subprocess.py. (#11356)

This commit is contained in:
Sven Mika 2020-10-13 21:42:20 +02:00 committed by GitHub
parent 63fa0a53a3
commit a6a94d3206
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 9 deletions

View file

@ -1184,7 +1184,7 @@ py_test(
py_test(
name = "tests/test_catalog",
tags = ["tests_dir", "tests_dir_C"],
size = "small",
size = "medium",
srcs = ["tests/test_catalog.py"]
)

View file

@ -56,11 +56,10 @@ if __name__ == "__main__":
},
},
})
# Check whether processes are still running or Env has not cleaned up
# the given tmp files.
ray.shutdown()
# Check whether processes are still running.
wait_for_condition(lambda: not leaked_processes(), timeout=30)
wait_for_condition(lambda: not os.path.exists(tmp1), timeout=30)
wait_for_condition(lambda: not os.path.exists(tmp2), timeout=30)
wait_for_condition(lambda: not os.path.exists(tmp3), timeout=30)
wait_for_condition(lambda: not os.path.exists(tmp4), timeout=30)
print("OK")

View file

@ -1,7 +1,7 @@
import unittest
import ray
from ray.rllib.agents.ppo import PPOTrainer, DEFAULT_CONFIG
from ray.rllib.agents.pg import PGTrainer, DEFAULT_CONFIG
from ray.rllib.utils.test_utils import framework_iterator
@ -14,8 +14,10 @@ class LocalModeTest(unittest.TestCase):
def test_local(self):
cf = DEFAULT_CONFIG.copy()
cf["model"]["fcnet_hiddens"] = [10]
for _ in framework_iterator(cf):
agent = PPOTrainer(cf, "CartPole-v0")
agent = PGTrainer(cf, "CartPole-v0")
print(agent.train())
agent.stop()