@@ -262,7 +262,6 @@ def test_config_creation():
262
262
assert config .worker_cpu_requests == 3 and config .worker_cpu_limits == 4
263
263
assert config .worker_memory_requests == "5G" and config .worker_memory_limits == "6G"
264
264
assert config .worker_extended_resource_requests == {"nvidia.com/gpu" : 7 }
265
- assert config .image == "quay.io/rhoai/ray:2.23.0-py39-cu121"
266
265
assert config .template == f"{ parent } /src/codeflare_sdk/templates/base-template.yaml"
267
266
assert config .machine_types == ["cpu.small" , "gpu.large" ]
268
267
assert config .image_pull_secrets == ["unit-test-pull-secret" ]
@@ -415,7 +414,6 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
415
414
worker_extended_resource_requests = {"nvidia.com/gpu" : 7 },
416
415
machine_types = ["cpu.small" , "gpu.large" ],
417
416
image_pull_secrets = ["unit-test-pull-secret" ],
418
- image = "quay.io/rhoai/ray:2.23.0-py39-cu121" ,
419
417
write_to_file = True ,
420
418
appwrapper = False ,
421
419
local_queue = "local-queue-default" ,
@@ -443,7 +441,6 @@ def test_default_cluster_creation(mocker):
443
441
)
444
442
default_config = ClusterConfiguration (
445
443
name = "unit-test-default-cluster" ,
446
- image = "quay.io/rhoai/ray:2.23.0-py39-cu121" ,
447
444
appwrapper = True ,
448
445
)
449
446
cluster = Cluster (default_config )
@@ -459,6 +456,61 @@ def test_default_cluster_creation(mocker):
459
456
assert cluster .config .namespace == "opendatahub"
460
457
461
458
459
+ def test_cluster_creation_with_custom_image (mocker ):
460
+ # With written resources
461
+ # Create Ray Cluster with local queue specified
462
+ mocker .patch ("kubernetes.client.ApisApi.get_api_versions" )
463
+ mocker .patch (
464
+ "kubernetes.client.CustomObjectsApi.get_cluster_custom_object" ,
465
+ return_value = {"spec" : {"domain" : "apps.cluster.awsroute.org" }},
466
+ )
467
+ mocker .patch (
468
+ "kubernetes.client.CustomObjectsApi.list_namespaced_custom_object" ,
469
+ return_value = get_local_queue ("kueue.x-k8s.io" , "v1beta1" , "ns" , "localqueues" ),
470
+ )
471
+ mocker .patch ("os.environ.get" , return_value = "test-prefix" )
472
+ config = createClusterConfig ()
473
+ config .name = "unit-test-cluster-custom-image"
474
+ config .appwrapper = False
475
+ config .image = "quay.io/project-codeflare/ray:2.20.0-py39-cu118"
476
+ config .local_queue = "local-queue-default"
477
+ config .labels = {"testlabel" : "test" , "testlabel2" : "test" }
478
+ cluster = Cluster (config )
479
+ assert cluster .app_wrapper_yaml == f"{ aw_dir } unit-test-cluster-custom-image.yaml"
480
+ assert cluster .app_wrapper_name == "unit-test-cluster-custom-image"
481
+ assert filecmp .cmp (
482
+ f"{ aw_dir } unit-test-cluster-custom-image.yaml" ,
483
+ f"{ parent } /tests/test-case-custom-image.yaml" ,
484
+ shallow = True ,
485
+ )
486
+ # With resources loaded in memory
487
+ config = ClusterConfiguration (
488
+ name = "unit-test-cluster-custom-image" ,
489
+ namespace = "ns" ,
490
+ num_workers = 2 ,
491
+ worker_cpu_requests = 3 ,
492
+ worker_cpu_limits = 4 ,
493
+ worker_memory_requests = 5 ,
494
+ worker_memory_limits = 6 ,
495
+ worker_extended_resource_requests = {"nvidia.com/gpu" : 7 },
496
+ machine_types = ["cpu.small" , "gpu.large" ],
497
+ image_pull_secrets = ["unit-test-pull-secret" ],
498
+ image = "quay.io/project-codeflare/ray:2.20.0-py39-cu118" ,
499
+ write_to_file = True ,
500
+ appwrapper = False ,
501
+ local_queue = "local-queue-default" ,
502
+ labels = {"testlabel" : "test" , "testlabel2" : "test" },
503
+ )
504
+ cluster = Cluster (config )
505
+ assert cluster .app_wrapper_yaml == f"{ aw_dir } unit-test-cluster-custom-image.yaml"
506
+ assert cluster .app_wrapper_name == "unit-test-cluster-custom-image"
507
+ assert filecmp .cmp (
508
+ f"{ aw_dir } unit-test-cluster-custom-image.yaml" ,
509
+ f"{ parent } /tests/test-case-custom-image.yaml" ,
510
+ shallow = True ,
511
+ )
512
+
513
+
462
514
def test_gen_names_with_name (mocker ):
463
515
mocker .patch .object (
464
516
uuid , "uuid4" , return_value = uuid .UUID ("00000000-0000-0000-0000-000000000001" )
@@ -792,7 +844,6 @@ def test_ray_job_wrapping(mocker):
792
844
return_value = get_local_queue ("kueue.x-k8s.io" , "v1beta1" , "ns" , "localqueues" ),
793
845
)
794
846
cluster = cluster = createClusterWithConfig (mocker )
795
- cluster .config .image = "quay.io/rhoai/ray:2.23.0-py39-cu121"
796
847
mocker .patch (
797
848
"ray.job_submission.JobSubmissionClient._check_connection_and_version_with_url" ,
798
849
return_value = "None" ,
@@ -910,7 +961,6 @@ def test_ray_details(mocker, capsys):
910
961
ClusterConfiguration (
911
962
name = "raytest2" ,
912
963
namespace = "ns" ,
913
- image = "quay.io/rhoai/ray:2.23.0-py39-cu121" ,
914
964
write_to_file = True ,
915
965
appwrapper = True ,
916
966
local_queue = "local_default_queue" ,
@@ -2313,7 +2363,6 @@ def test_cluster_status(mocker):
2313
2363
ClusterConfiguration (
2314
2364
name = "test" ,
2315
2365
namespace = "ns" ,
2316
- image = "quay.io/rhoai/ray:2.23.0-py39-cu121" ,
2317
2366
write_to_file = True ,
2318
2367
appwrapper = True ,
2319
2368
local_queue = "local_default_queue" ,
@@ -2408,7 +2457,6 @@ def test_wait_ready(mocker, capsys):
2408
2457
ClusterConfiguration (
2409
2458
name = "test" ,
2410
2459
namespace = "ns" ,
2411
- image = "quay.io/rhoai/ray:2.23.0-py39-cu121" ,
2412
2460
write_to_file = True ,
2413
2461
appwrapper = True ,
2414
2462
local_queue = "local-queue-default" ,
@@ -2635,7 +2683,6 @@ def throw_if_getting_raycluster(group, version, namespace, plural):
2635
2683
cluster = Cluster (
2636
2684
ClusterConfiguration (
2637
2685
"test_cluster" ,
2638
- image = "quay.io/rhoai/ray:2.23.0-py39-cu121" ,
2639
2686
write_to_file = False ,
2640
2687
)
2641
2688
)
0 commit comments