ray/release/ml_user_tests/tune_rllib/run_connect_tests.py
Amog Kamsetty 3408b60d2b
[Release] Refactor User Tests (#20028)
* wip

* add directory

* wip

* try again

* Revert "try again"

This reverts commit 82d33ccea6f92848df025e019b87df73cea49e5d.

* finish

* formatting

* fix merge

* fix path

* chmod

* check

* sudo

* wip

* update

* fix horovod

* try

* typo

* reduce num workers
2021-11-05 17:28:37 -07:00

38 lines
978 B
Python

"""Connect tests for Tune & RLlib.
Runs a couple of hard learning tests using Anyscale connect.
"""
import json
import os
import time
import ray
from ray.rllib.examples.tune.framework import run
if __name__ == "__main__":
addr = os.environ.get("RAY_ADDRESS")
job_name = os.environ.get("RAY_JOB_NAME", "rllib_connect_tests")
if addr is not None and addr.startswith("anyscale://"):
ray.init(address=addr, job_name=job_name)
else:
ray.init(address="auto")
start_time = time.time()
exp_analysis = run()
end_time = time.time()
result = {
"time_taken": end_time - start_time,
"trial_states": {
t.config["framework"]: t.status
for t in exp_analysis.trials
},
}
test_output_json = os.environ.get("TEST_OUTPUT_JSON",
"/tmp/release_test_out.json")
with open(test_output_json, "wt") as f:
json.dump(result, f)
print("Ok.")