sanity_check.py 995 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import click
  2. import ray
  3. import sys
  4. @click.command()
  5. @click.option("--ray_version", required=True, type=str)
  6. @click.option("--ray_commit", required=True, type=str)
  7. def main(ray_version, ray_commit):
  8. print("Sanity check python version: {}".format(sys.version))
  9. assert (
  10. ray_version == ray.__version__
  11. ), "Given Ray version {} is not matching with downloaded " "version {}".format(
  12. ray_version, ray.__version__
  13. )
  14. assert (
  15. ray_commit == ray.__commit__
  16. ), "Given Ray commit {} is not matching with downloaded " "version {}".format(
  17. ray_commit, ray.__commit__
  18. )
  19. assert ray.__file__ is not None
  20. ray.init()
  21. assert ray.is_initialized()
  22. @ray.remote
  23. def return_arg(arg):
  24. return arg
  25. val = 3
  26. print("Running basic sanity check.")
  27. assert ray.get(return_arg.remote(val)) == val
  28. ray.shutdown()
  29. print("Sanity check succeeded on Python {}".format(sys.version))
  30. if __name__ == "__main__":
  31. main()