pip_download_test.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. # This script automatically download ray and run the sanity check (sanity_check.py and sanity_check_cpp.sh)
  3. # in various Python version. This script requires conda command to exist.
  4. unset RAY_ADDRESS
  5. export RAY_HASH=$RAY_HASH
  6. export RAY_VERSION=$RAY_VERSION
  7. if [[ -z "$RAY_HASH" ]]; then
  8. echo "RAY_HASH env var should be provided"
  9. exit 1
  10. fi
  11. if [[ -z "$RAY_VERSION" ]]; then
  12. echo "RAY_VERSION env var should be provided"
  13. exit 1
  14. fi
  15. if ! [ -x "$(command -v conda)" ]; then
  16. echo "conda doesn't exist. Please download conda for this machine"
  17. exit 1
  18. else
  19. echo "conda exists"
  20. fi
  21. echo "Start downloading Ray version ${RAY_VERSION} of commit ${RAY_HASH}"
  22. pip install --upgrade pip
  23. # This is required to use conda activate
  24. source "$(conda info --base)/etc/profile.d/conda.sh"
  25. PYTHON_VERSIONS=( "3.8" "3.9" "3.10" "3.11" )
  26. for PYTHON_VERSION in "${PYTHON_VERSIONS[@]}"
  27. do
  28. env_name="${RAY_VERSION}-${PYTHON_VERSION}-env"
  29. conda create -y -n "${env_name}" python="${PYTHON_VERSION}"
  30. conda activate "${env_name}"
  31. printf "\n\n\n"
  32. echo "========================================================="
  33. echo "Python version."
  34. python --version
  35. echo "This should be equal to ${PYTHON_VERSION}"
  36. echo "========================================================="
  37. printf "\n\n\n"
  38. # shellcheck disable=SC2102
  39. pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ray[cpp]=="${RAY_VERSION}"
  40. failed=false
  41. cpp_failed=false
  42. printf "\n\n\n"
  43. echo "========================================================="
  44. if python sanity_check.py --ray_version="$RAY_VERSION" --ray_commit="$RAY_HASH"; then
  45. echo "PYTHON ${PYTHON_VERSION} succeed sanity check."
  46. else
  47. failed=true
  48. fi
  49. if bash sanity_check_cpp.sh; then
  50. echo "PYTHON ${PYTHON_VERSION} succeed sanity check C++."
  51. else
  52. cpp_failed=true
  53. fi
  54. echo "========================================================="
  55. printf "\n\n\n"
  56. conda deactivate
  57. conda remove -y --name "${env_name}" --all
  58. if [ "$failed" = true ]; then
  59. echo "PYTHON ${PYTHON_VERSION} failed sanity check."
  60. exit 1
  61. fi
  62. if [ "$cpp_failed" = true ]; then
  63. echo "PYTHON ${PYTHON_VERSION} failed sanity check C++."
  64. exit 1
  65. fi
  66. done