dask_xgboost_test.py 887 B

123456789101112131415161718192021222324252627282930313233343536
  1. import ray
  2. import os
  3. import time
  4. import json
  5. from util import import_and_execute_test_script
  6. NOTEBOOK_PATH_RELATIVE_TO_RAY_REPO = (
  7. "doc/source/ray-core/examples/dask_xgboost/dask_xgboost.py"
  8. )
  9. def main():
  10. import_and_execute_test_script(NOTEBOOK_PATH_RELATIVE_TO_RAY_REPO)
  11. if __name__ == "__main__":
  12. start = time.time()
  13. addr = os.environ.get("RAY_ADDRESS")
  14. job_name = os.environ.get("RAY_JOB_NAME", "dask_xgboost_test")
  15. if addr is not None and addr.startswith("anyscale://"):
  16. ray.init(address=addr, job_name=job_name)
  17. else:
  18. ray.init(address="auto")
  19. main()
  20. taken = time.time() - start
  21. result = {
  22. "time_taken": taken,
  23. }
  24. test_output_json = os.environ.get("TEST_OUTPUT_JSON", "/tmp/dask_xgboost_test.json")
  25. with open(test_output_json, "wt") as f:
  26. json.dump(result, f)
  27. print("Test Successful!")