Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
steps:

- name: Checkout code
# Do not change this to v5 until cirun can handle node v24
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Build on Linux
Expand Down
6 changes: 6 additions & 0 deletions recipe/build-core.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ echo %CONDA_PREFIX%
python -c "import os; print('\n'.join(os.environ['PATH'].split(';')))"
echo ----------

echo ========================================
echo Fix up the sha in python/ray/_version.py
echo ========================================
"%PYTHON%" "%RECIPE_DIR%/fixup_sha.py" python/ray/_version.py "%PKG_VERSION%"


echo ==========================================================
echo calling pip to install
echo ==========================================================
Expand Down
5 changes: 5 additions & 0 deletions recipe/build-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ echo '---------------- .bazelrc --------------------------'
cat .bazelrc
echo '----------------------------------------------------'

echo ========================================
echo Fix up the sha in python/ray/_version.py
echo ========================================
python3 ${RECIPE_DIR}/fixup_sha.py python/ray/_version.py ${PKG_VERSION}

cd python/
export SKIP_THIRDPARTY_INSTALL_CONDA_FORGE=1

Expand Down
56 changes: 56 additions & 0 deletions recipe/fixup_sha.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Call like python3 __file__ python/ray/_version.py 2.49.2

import json
import os
import sys
import time
from urllib.request import HTTPError, urlopen


def get_commit_sha(ver: str) -> str:
"""
Return sha from version tag commit.

Use retry information in headers and exponential backoff to address rate limiting issues.
See: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#exceeding-the-rate-limit
"""
exp_backoff = 60
retry_count = 0
while True:
try:
content = urlopen(
f"https://api.github.com/repos/ray-project/ray/git/ref/tags/ray-{ver}"
).read()
return json.loads(content)["object"]["sha"]
except HTTPError as e:
if retry_count < 10:
if (e.code == 403 and e.msg == "rate limit exceeded") or e.code == 429:
retry_count += 1
timeout = exp_backoff
if "retry-after" in e.hdrs:
timeout = int(e.hdrs["retry-after"])
elif e.hdrs.get("x-ratelimit-remaining", None) == "0":
timeout = max(int(e.hdrs["x-ratelimit-reset"]) - time.time(), 0)
else:
exp_backoff *= 1.5
print(f"{e}:, retrying after {timeout} s", file=sys.stderr)
time.sleep(timeout)
continue
raise


versionpy = sys.argv[1]
ver = sys.argv[2]

assert os.path.exists(versionpy)

with open(versionpy, "r") as fid:
txt = fid.read()

sha = get_commit_sha(ver)

txt = txt.replace("{{RAY_COMMIT_SHA}}", sha)
assert f'version = "{ver}"' in txt
assert f'commit = "{sha}"' in txt
with open(versionpy, "w") as fid:
fid.write(txt)
23 changes: 0 additions & 23 deletions recipe/patches/0004-update-commit-sha.patch

This file was deleted.

5 changes: 2 additions & 3 deletions recipe/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ source:
- patches/0001-Disable-making-entry-scripts.patch
- patches/0002-Ignore-warnings-in-event.cc-and-logging.cc.patch
- patches/0003-Newer-hermetic-python.patch
# This needs modification for each release
- patches/0004-update-commit-sha.patch
# See https://github.com/conda-forge/ray-packages-feedstock/issues/136
# Keep in sync with current or active migration of libgrpc to avoid
# ABI breakage
Expand All @@ -35,7 +33,8 @@ source:
- patches/0012-No-path-isolation.patch

build:
number: 0
number: 2


outputs:
- package:
Expand Down