File tree Expand file tree Collapse file tree 6 files changed +70
-26
lines changed
Expand file tree Collapse file tree 6 files changed +70
-26
lines changed Original file line number Diff line number Diff line change 4444 steps :
4545
4646 - name : Checkout code
47+ # Do not change this to v5 until cirun can handle node v24
4748 uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
4849
4950 - name : Build on Linux
Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ echo %CONDA_PREFIX%
2727python -c " import os; print('\n'.join(os.environ['PATH'].split(';')))"
2828echo ----------
2929
30+ echo ========================================
31+ echo Fix up the sha in python/ray/_version.py
32+ echo ========================================
33+ " %PYTHON% " " %RECIPE_DIR% /fixup_sha.py" python/ray/_version.py " %PKG_VERSION% "
34+
35+
3036echo ==========================================================
3137echo calling pip to install
3238echo ==========================================================
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ echo '---------------- .bazelrc --------------------------'
4949cat .bazelrc
5050echo ' ----------------------------------------------------'
5151
52+ echo ========================================
53+ echo Fix up the sha in python/ray/_version.py
54+ echo ========================================
55+ python3 ${RECIPE_DIR} /fixup_sha.py python/ray/_version.py ${PKG_VERSION}
56+
5257cd python/
5358export SKIP_THIRDPARTY_INSTALL_CONDA_FORGE=1
5459
Original file line number Diff line number Diff line change 1+ # Call like python3 __file__ python/ray/_version.py 2.49.2
2+
3+ import json
4+ import os
5+ import sys
6+ import time
7+ from urllib .request import HTTPError , urlopen
8+
9+
10+ def get_commit_sha (ver : str ) -> str :
11+ """
12+ Return sha from version tag commit.
13+
14+ Use retry information in headers and exponential backoff to address rate limiting issues.
15+ 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
16+ """
17+ exp_backoff = 60
18+ retry_count = 0
19+ while True :
20+ try :
21+ content = urlopen (
22+ f"https://api.github.com/repos/ray-project/ray/git/ref/tags/ray-{ ver } "
23+ ).read ()
24+ return json .loads (content )["object" ]["sha" ]
25+ except HTTPError as e :
26+ if retry_count < 10 :
27+ if (e .code == 403 and e .msg == "rate limit exceeded" ) or e .code == 429 :
28+ retry_count += 1
29+ timeout = exp_backoff
30+ if "retry-after" in e .hdrs :
31+ timeout = int (e .hdrs ["retry-after" ])
32+ elif e .hdrs .get ("x-ratelimit-remaining" , None ) == "0" :
33+ timeout = max (int (e .hdrs ["x-ratelimit-reset" ]) - time .time (), 0 )
34+ else :
35+ exp_backoff *= 1.5
36+ print (f"{ e } :, retrying after { timeout } s" , file = sys .stderr )
37+ time .sleep (timeout )
38+ continue
39+ raise
40+
41+
42+ versionpy = sys .argv [1 ]
43+ ver = sys .argv [2 ]
44+
45+ assert os .path .exists (versionpy )
46+
47+ with open (versionpy , "r" ) as fid :
48+ txt = fid .read ()
49+
50+ sha = get_commit_sha (ver )
51+
52+ txt = txt .replace ("{{RAY_COMMIT_SHA}}" , sha )
53+ assert f'version = "{ ver } "' in txt
54+ assert f'commit = "{ sha } "' in txt
55+ with open (versionpy , "w" ) as fid :
56+ fid .write (txt )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ source:
1515 - patches/0001-Disable-making-entry-scripts.patch
1616 - patches/0002-Ignore-warnings-in-event.cc-and-logging.cc.patch
1717 - patches/0003-Newer-hermetic-python.patch
18- # This needs modification for each release
19- - patches/0004-update-commit-sha.patch
2018 # See https://github.com/conda-forge/ray-packages-feedstock/issues/136
2119 # Keep in sync with current or active migration of libgrpc to avoid
2220 # ABI breakage
@@ -35,7 +33,8 @@ source:
3533 - patches/0012-No-path-isolation.patch
3634
3735build :
38- number : 0
36+ number : 2
37+
3938
4039outputs :
4140 - package :
You can’t perform that action at this time.
0 commit comments