2021-08-18 17:21:01 +02:00
|
|
|
"""Multi-GPU learning tests for RLlib (torch and tf).
|
|
|
|
"""
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from ray.rllib.utils.test_utils import run_learning_tests_from_yaml
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
# Get path of this very script to look for yaml files.
|
|
|
|
abs_yaml_path = Path(__file__).parent
|
|
|
|
print("abs_yaml_path={}".format(abs_yaml_path))
|
|
|
|
|
2021-09-06 17:48:05 +02:00
|
|
|
yaml_files = abs_yaml_path.rglob("*.yaml")
|
2021-08-18 17:21:01 +02:00
|
|
|
yaml_files = sorted(
|
2022-01-29 18:41:57 -08:00
|
|
|
map(lambda path: str(path.absolute()), yaml_files), reverse=True
|
|
|
|
)
|
2021-08-18 17:21:01 +02:00
|
|
|
|
|
|
|
# Run all tests in the found yaml files.
|
|
|
|
results = run_learning_tests_from_yaml(yaml_files)
|
|
|
|
|
|
|
|
test_output_json = os.environ.get(
|
2022-01-29 18:41:57 -08:00
|
|
|
"TEST_OUTPUT_JSON", "/tmp/rllib_multi_gpu_learning_tests.json"
|
|
|
|
)
|
2021-08-18 17:21:01 +02:00
|
|
|
with open(test_output_json, "wt") as f:
|
|
|
|
json.dump(results, f)
|
|
|
|
|
|
|
|
print("Ok.")
|