Skip to content

Commit a63dc7f

Browse files
committed
RHOAIENG-27828: Template runtime image SHA
1 parent 7236640 commit a63dc7f

File tree

11 files changed

+61
-32
lines changed

11 files changed

+61
-32
lines changed

demo-notebooks/guided-demos/notebook-ex-outputs/0_basic_ray.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"\n",
5050
"NOTE: The default images used by the CodeFlare SDK for creating a RayCluster resource depend on the installed Python version:\n",
5151
"\n",
52-
"- For Python 3.11: 'quay.io/modh/ray:2.46.0-py311-cu121'\n",
52+
"- For Python 3.11: 'quay.io/modh/ray:2.47.1-py311-cu121'\n",
5353
"\n",
5454
"If you prefer to use a custom Ray image that better suits your needs, you can specify it in the image field to override the default."
5555
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
RAY_VERSION = "2.47.1"
2+
# Below references ray:2.47.1-py311-cu121
3+
CUDA_RUNTIME_IMAGE = "quay.io/modh/ray@sha256:6d076aeb38ab3c34a6a2ef0f58dc667089aa15826fa08a73273c629333e12f1e"

src/codeflare_sdk/common/utils/unit_test_support.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import string
1616
import sys
17+
from codeflare_sdk.common.utils import constants
1718
from codeflare_sdk.ray.cluster.cluster import (
1819
Cluster,
1920
ClusterConfiguration,
@@ -68,7 +69,7 @@ def create_cluster_wrong_type():
6869
worker_extended_resource_requests={"nvidia.com/gpu": 7},
6970
appwrapper=True,
7071
image_pull_secrets=["unit-test-pull-secret"],
71-
image="quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707",
72+
image=constants.CUDA_RUNTIME_IMAGE,
7273
write_to_file=True,
7374
labels={1: 1},
7475
)
@@ -148,19 +149,29 @@ def get_cluster_object(file_a, file_b):
148149

149150
def get_ray_obj(group, version, namespace, plural):
150151
# To be used for mocking list_namespaced_custom_object for Ray Clusters
151-
rc_a_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-a.yaml"
152-
rc_b_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-b.yaml"
153-
rc_a, rc_b = get_cluster_object(rc_a_path, rc_b_path)
152+
rc_a = apply_template(
153+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-a.yaml",
154+
get_template_variables(),
155+
)
156+
rc_b = apply_template(
157+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-b.yaml",
158+
get_template_variables(),
159+
)
154160

155161
rc_list = {"items": [rc_a, rc_b]}
156162
return rc_list
157163

158164

159165
def get_ray_obj_with_status(group, version, namespace, plural):
160166
# To be used for mocking list_namespaced_custom_object for Ray Clusters with statuses
161-
rc_a_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-a.yaml"
162-
rc_b_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-b.yaml"
163-
rc_a, rc_b = get_cluster_object(rc_a_path, rc_b_path)
167+
rc_a = apply_template(
168+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-a.yaml",
169+
get_template_variables(),
170+
)
171+
rc_b = apply_template(
172+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-rc-b.yaml",
173+
get_template_variables(),
174+
)
164175

165176
rc_a.update(
166177
{
@@ -205,19 +216,29 @@ def get_ray_obj_with_status(group, version, namespace, plural):
205216

206217
def get_aw_obj(group, version, namespace, plural):
207218
# To be used for mocking list_namespaced_custom_object for AppWrappers
208-
aw_a_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-a.yaml"
209-
aw_b_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-b.yaml"
210-
aw_a, aw_b = get_cluster_object(aw_a_path, aw_b_path)
219+
aw_a = apply_template(
220+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-a.yaml",
221+
get_template_variables(),
222+
)
223+
aw_b = apply_template(
224+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-b.yaml",
225+
get_template_variables(),
226+
)
211227

212228
aw_list = {"items": [aw_a, aw_b]}
213229
return aw_list
214230

215231

216232
def get_aw_obj_with_status(group, version, namespace, plural):
217233
# To be used for mocking list_namespaced_custom_object for AppWrappers with statuses
218-
aw_a_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-a.yaml"
219-
aw_b_path = f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-b.yaml"
220-
aw_a, aw_b = get_cluster_object(aw_a_path, aw_b_path)
234+
aw_a = apply_template(
235+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-a.yaml",
236+
get_template_variables(),
237+
)
238+
aw_b = apply_template(
239+
f"{parent}/tests/test_cluster_yamls/support_clusters/test-aw-b.yaml",
240+
get_template_variables(),
241+
)
221242

222243
aw_a.update(
223244
{
@@ -273,9 +294,8 @@ def apply_template(yaml_file_path, variables):
273294

274295

275296
def get_expected_image():
276-
# TODO: Add Python 3.12 support
277-
python_version = sys.version_info
278-
return "quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707"
297+
# TODO: Select image based on Python version
298+
return constants.CUDA_RUNTIME_IMAGE
279299

280300

281301
def get_template_variables():

src/codeflare_sdk/ray/appwrapper/test_awload.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
from codeflare_sdk.common.utils.unit_test_support import (
15+
apply_template,
1516
arg_check_aw_apply_effect,
1617
arg_check_aw_del_effect,
18+
get_template_variables,
1719
)
1820
from codeflare_sdk.ray.appwrapper import AWManager
1921
from codeflare_sdk.ray.cluster import Cluster, ClusterConfiguration
@@ -47,8 +49,11 @@ def test_AWManager_creation(mocker):
4749
assert type(e) == FileNotFoundError
4850
assert str(e) == "[Errno 2] No such file or directory: 'fake'"
4951
try:
50-
testaw = AWManager(
51-
f"{parent}/tests/test_cluster_yamls/appwrapper/test-case-bad.yaml"
52+
testaw = apply_template(
53+
AWManager(
54+
f"{parent}/tests/test_cluster_yamls/appwrapper/test-case-bad.yaml"
55+
),
56+
get_template_variables(),
5257
)
5358
except Exception as e:
5459
assert type(e) == ValueError

src/codeflare_sdk/ray/cluster/build_ray_cluster.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
import warnings
5151
import json
5252

53+
from codeflare_sdk.common.utils import constants
54+
5355
FORBIDDEN_CUSTOM_RESOURCE_TYPES = ["GPU", "CPU", "memory"]
5456
VOLUME_MOUNTS = [
5557
V1VolumeMount(
@@ -94,7 +96,7 @@
9496
]
9597

9698
SUPPORTED_PYTHON_VERSIONS = {
97-
"3.11": "quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707",
99+
"3.11": constants.CUDA_RUNTIME_IMAGE,
98100
}
99101

100102

tests/e2e/support.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from codeflare_sdk.common.kubernetes_cluster.kube_api_helpers import (
88
_kube_api_error_handling,
99
)
10+
from codeflare_sdk.common.utils import constants
1011

1112

1213
def get_ray_cluster(cluster_name, namespace):
@@ -26,8 +27,7 @@ def get_ray_cluster(cluster_name, namespace):
2627

2728

2829
def get_ray_image():
29-
default_ray_image = "quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707"
30-
return os.getenv("RAY_IMAGE", default_ray_image)
30+
return os.getenv("RAY_IMAGE", constants.CUDA_RUNTIME_IMAGE)
3131

3232

3333
def get_setup_env_variables(**kwargs):

tests/test_cluster_yamls/appwrapper/test-case-bad.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
valueFrom:
4343
fieldRef:
4444
fieldPath: status.podIP
45-
image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
45+
image: "${image}"
4646
imagePullPolicy: IfNotPresent
4747
lifecycle:
4848
preStop:
@@ -89,7 +89,7 @@ spec:
8989
valueFrom:
9090
fieldRef:
9191
fieldPath: status.podIP
92-
image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
92+
image: "${image}"
9393
lifecycle:
9494
preStop:
9595
exec:

tests/test_cluster_yamls/support_clusters/test-aw-a.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
template:
3939
spec:
4040
containers:
41-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
41+
- image: "${image}"
4242
imagePullPolicy: IfNotPresent
4343
lifecycle:
4444
preStop:
@@ -109,7 +109,7 @@ spec:
109109
key: value
110110
spec:
111111
containers:
112-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
112+
- image: "${image}"
113113
lifecycle:
114114
preStop:
115115
exec:

tests/test_cluster_yamls/support_clusters/test-aw-b.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
template:
3939
spec:
4040
containers:
41-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
41+
- image: "${image}"
4242
imagePullPolicy: IfNotPresent
4343
lifecycle:
4444
preStop:
@@ -109,7 +109,7 @@ spec:
109109
key: value
110110
spec:
111111
containers:
112-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
112+
- image: "${image}"
113113
lifecycle:
114114
preStop:
115115
exec:

tests/test_cluster_yamls/support_clusters/test-rc-a.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
template:
3030
spec:
3131
containers:
32-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
32+
- image: "${image}"
3333
imagePullPolicy: IfNotPresent
3434
lifecycle:
3535
preStop:
@@ -100,7 +100,7 @@ spec:
100100
key: value
101101
spec:
102102
containers:
103-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
103+
- image: "${image}"
104104
lifecycle:
105105
preStop:
106106
exec:

tests/test_cluster_yamls/support_clusters/test-rc-b.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
template:
3030
spec:
3131
containers:
32-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
32+
- image: "${image}"
3333
imagePullPolicy: IfNotPresent
3434
lifecycle:
3535
preStop:
@@ -100,7 +100,7 @@ spec:
100100
key: value
101101
spec:
102102
containers:
103-
- image: quay.io/modh/ray@sha256:a5b7c04a14f180d7ca6d06a5697f6bb684e40a26b95a0c872cac23b552741707
103+
- image: "${image}"
104104
lifecycle:
105105
preStop:
106106
exec:

0 commit comments

Comments
 (0)