def current_ray_pip_specifier( logger: Optional[logging.Logger] = default_logger) -> Optional[str]: """The pip requirement specifier for the running version of Ray. Returns: A string which can be passed to `pip install` to install the currently running Ray version, or None if running on a version built from source locally (likely if you are developing Ray). Examples: Returns "https://s3-us-west-2.amazonaws.com/ray-wheels/[..].whl" if running a stable release, a nightly or a specific commit """ if os.environ.get("RAY_CI_POST_WHEEL_TESTS"): # Running in Buildkite CI after the wheel has been built. # Wheels are at in the ray/.whl directory, but use relative path to # allow for testing locally if needed. return os.path.join( Path(ray.__file__).resolve().parents[2], ".whl", get_wheel_filename()) elif ray.__commit__ == "{{RAY_COMMIT_SHA}}": # Running on a version built from source locally. if os.environ.get("RAY_RUNTIME_ENV_LOCAL_DEV_MODE") != "1": logger.warning( "Current Ray version could not be detected, most likely " "because you have manually built Ray from source. To use " "runtime_env in this case, set the environment variable " "RAY_RUNTIME_ENV_LOCAL_DEV_MODE=1.") return None elif "dev" in ray.__version__: # Running on a nightly wheel. return get_master_wheel_url() else: return get_release_wheel_url()
def current_ray_pip_specifier() -> Optional[str]: """The pip requirement specifier for the running version of Ray. Returns: A string which can be passed to `pip install` to install the currently running Ray version, or None if running on a version built from source locally (likely if you are developing Ray). Examples: Returns "ray[all]==1.4.0" if running the stable release Returns "https://s3-us-west-2.amazonaws.com/ray-wheels/master/[..].whl" if running the nightly or a specific commit """ if os.environ.get("RAY_CI_POST_WHEEL_TESTS"): # Running in Buildkite CI after the wheel has been built. # Wheels are at in the ray/.whl directory, and the present file is # at ray/python/ray/workers. Use relative paths to allow for # testing locally if needed. return os.path.join( Path(__file__).resolve().parents[3], ".whl", get_wheel_filename()) elif ray.__commit__ == "{{RAY_COMMIT_SHA}}": # Running on a version built from source locally. logger.warning( "Current Ray version could not be detected, most likely " "because you are using a version of Ray " "built from source. If you wish to use runtime_env, " "you can try building a wheel and including the wheel " "explicitly as a pip dependency.") return None elif "dev" in ray.__version__: # Running on a nightly wheel. return get_master_wheel_url() else: return get_release_wheel_url()
def test_get_release_wheel_url(): test_commits = {"1.6.0": "5052fe67d99f1d4bfc81b2a8694dbf2aa807bbdc"} for sys_platform in ["darwin", "linux", "win32"]: for py_version in ["36", "37", "38", "39"]: for version, commit in test_commits.items(): url = get_release_wheel_url(commit, sys_platform, version, py_version) assert requests.head(url).status_code == 200, url
def test_get_release_wheel_url(): test_commits = { "1.4.0rc1": "e7c7f6371a69eb727fa469e4cd6f4fbefd143b4c", "1.3.0": "0b4b444fadcdc23226e11fef066b982175804232", "1.2.0": "1b1a2496ca51b745c07c79fb859946d3350d471b" } for sys_platform in ["darwin", "linux", "win32"]: for py_version in ["36", "37", "38"]: for version, commit in test_commits.items(): url = get_release_wheel_url(commit, sys_platform, version, py_version) assert requests.head(url).status_code == 200, url
if __name__ == "__main__": # Fail if running on a build from source that doesn't have a commit and # hasn't been uploaded as a wheel to AWS. assert "RAY_COMMIT_SHA" not in ray.__commit__, ray.__commit__ retry = [] for sys_platform in ["darwin", "linux", "win32"]: for py_version in ["36", "37", "38", "39"]: if "dev" in ray.__version__: url = get_master_wheel_url(ray_commit=ray.__commit__, sys_platform=sys_platform, ray_version=ray.__version__, py_version=py_version) else: url = get_release_wheel_url(ray_commit=ray.__commit__, sys_platform=sys_platform, ray_version=ray.__version__, py_version=py_version) if requests.head(url).status_code != 200: print("URL not found (yet?):", url) retry.append(url) continue print("Successfully tested URL: ", url) update_progress({"url": url}) if retry: print(f"There are {len(retry)} URLs to retry. Sleeping 10 minutes " f"to give some time for wheels to be built.") print("List of URLs to retry:", retry) time.sleep(600) print("Retrying now...") for url in retry: