@@ -19,8 +19,6 @@ package odh
19
19
import (
20
20
"bytes"
21
21
"fmt"
22
- "log"
23
- "os/exec"
24
22
"testing"
25
23
"time"
26
24
@@ -35,22 +33,22 @@ import (
35
33
)
36
34
37
35
func TestMnistRayCpu (t * testing.T ) {
38
- mnistDefaultRayImage (t , 0 )
36
+ mnistRay (t , 0 )
39
37
}
40
38
41
39
func TestMnistRayGpu (t * testing.T ) {
42
- mnistDefaultRayImage (t , 1 )
40
+ mnistRay (t , 1 )
43
41
}
44
42
45
43
func TestMnistCustomRayImageCpu (t * testing.T ) {
46
- mnistCustomRayImage (t , 0 )
44
+ mnistRay (t , 0 )
47
45
}
48
46
49
47
func TestMnistCustomRayImageGpu (t * testing.T ) {
50
- mnistCustomRayImage (t , 1 )
48
+ mnistRay (t , 1 )
51
49
}
52
50
53
- func mnistDefaultRayImage (t * testing.T , numGpus int ) {
51
+ func mnistRay (t * testing.T , numGpus int ) {
54
52
test := With (t )
55
53
56
54
// Create a namespace
@@ -59,26 +57,6 @@ func mnistDefaultRayImage(t *testing.T, numGpus int) {
59
57
// Get ray image
60
58
rayImage := GetRayImage ()
61
59
62
- mnistRay (test , numGpus , namespace , rayImage )
63
- }
64
-
65
- func mnistCustomRayImage (t * testing.T , numGpus int ) {
66
- test := With (t )
67
-
68
- // Create a namespace
69
- namespace := test .NewTestNamespace ()
70
-
71
- // Build and Push custom ray image
72
- image := "ray-torch-cuda"
73
- buildAndPushRayImage (test , namespace .Name , image )
74
-
75
- // Get custom ray image
76
- rayImage := getCustomRayImage (test , namespace .Name , image )
77
-
78
- mnistRay (test , numGpus , namespace , rayImage )
79
- }
80
-
81
- func mnistRay (test Test , numGpus int , namespace * corev1.Namespace , rayImage string ) {
82
60
// Create Kueue resources
83
61
resourceFlavor := CreateKueueResourceFlavor (test , v1beta1.ResourceFlavorSpec {})
84
62
defer test .Client ().Kueue ().KueueV1beta1 ().ResourceFlavors ().Delete (test .Ctx (), resourceFlavor .Name , metav1.DeleteOptions {})
@@ -248,25 +226,3 @@ func readMnistScriptTemplate(test Test, filePath string) []byte {
248
226
249
227
return ParseTemplate (test , template , props )
250
228
}
251
-
252
- func buildAndPushRayImage (test Test , namespace string , image string ) {
253
- cmd := exec .Command ("resources/custom_image.sh" , namespace , image , "-c" , "echo stdout; echo 1>&2 stderr" )
254
-
255
- stdoutStderr , err := cmd .CombinedOutput ()
256
- if err != nil {
257
- log .Fatal ("Error executing custom_image script :" , err )
258
- }
259
- test .Expect (err ).NotTo (HaveOccurred ())
260
-
261
- fmt .Printf ("Logs of build and custom ray image . . .\n %s" , stdoutStderr )
262
- }
263
-
264
- func getCustomRayImage (test Test , namespace string , image string ) string {
265
- tag := "latest"
266
- name := image + ":" + tag
267
-
268
- imageStreamTag := GetImageStreamTag (test , namespace , name )
269
- imageReference := imageStreamTag .Image .DockerImageReference
270
-
271
- return imageReference
272
- }
0 commit comments