sanity_check.py 872 B

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. import ray
  3. import sys
  4. RAY_VERSION = "RAY_VERSION"
  5. RAY_COMMIT = "RAY_HASH"
  6. ray_version = os.getenv(RAY_VERSION)
  7. ray_commit = os.getenv(RAY_COMMIT)
  8. if __name__ == "__main__":
  9. print("Sanity check python version: {}".format(sys.version))
  10. assert (
  11. ray_version == ray.__version__
  12. ), "Given Ray version {} is not matching with downloaded " "version {}".format(
  13. ray_version, ray.__version__
  14. )
  15. assert (
  16. ray_commit == ray.__commit__
  17. ), "Given Ray commit {} is not matching with downloaded " "version {}".format(
  18. ray_commit, ray.__commit__
  19. )
  20. assert ray.__file__ is not None
  21. ray.init()
  22. assert ray.is_initialized()
  23. @ray.remote
  24. def return_arg(arg):
  25. return arg
  26. val = 3
  27. print("Running basic sanity check.")
  28. assert ray.get(return_arg.remote(val)) == val
  29. ray.shutdown()