2021-06-01 17:39:18 +02:00
|
|
|
"""Stress tests for RLlib (torch and tf).
|
|
|
|
|
|
|
|
Runs IMPALA on 4 GPUs and 100s of CPUs.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
|
2021-08-18 17:21:01 +02:00
|
|
|
from ray.rllib.utils.test_utils import run_learning_tests_from_yaml
|
2021-06-01 17:39:18 +02:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-09-16 18:22:23 +02:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument(
|
|
|
|
"--smoke-test",
|
|
|
|
action="store_true",
|
|
|
|
default=False,
|
2022-01-29 18:41:57 -08:00
|
|
|
help="Finish quickly for training.",
|
|
|
|
)
|
2021-09-16 18:22:23 +02:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
2021-06-01 17:39:18 +02:00
|
|
|
# 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-06-01 17:39:18 +02:00
|
|
|
yaml_files = sorted(
|
2022-01-29 18:41:57 -08:00
|
|
|
map(lambda path: str(path.absolute()), yaml_files), reverse=True
|
|
|
|
)
|
2021-06-01 17:39:18 +02:00
|
|
|
|
2021-09-16 18:22:23 +02:00
|
|
|
# Run all tests in the found yaml files.
|
2021-09-01 21:46:06 +02:00
|
|
|
results = run_learning_tests_from_yaml(
|
|
|
|
yaml_files=yaml_files,
|
|
|
|
max_num_repeats=1,
|
|
|
|
smoke_test=args.smoke_test,
|
|
|
|
)
|
2021-06-01 17:39:18 +02:00
|
|
|
|
2022-01-29 18:41:57 -08:00
|
|
|
test_output_json = os.environ.get(
|
|
|
|
"TEST_OUTPUT_JSON", "/tmp/rllib_stress_tests.json"
|
|
|
|
)
|
2021-06-01 17:39:18 +02:00
|
|
|
with open(test_output_json, "wt") as f:
|
2021-08-18 17:21:01 +02:00
|
|
|
json.dump(results, f)
|
2021-06-01 17:39:18 +02:00
|
|
|
|
2021-08-18 17:21:01 +02:00
|
|
|
print("Ok.")
|