@@ -17,7 +17,6 @@ limitations under the License.
1717package e2e
1818
1919import (
20- "encoding/base64"
2120 "testing"
2221
2322 . "github.com/onsi/gomega"
@@ -143,13 +142,6 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
143142 RayStartParams : map [string ]string {},
144143 Template : corev1.PodTemplateSpec {
145144 Spec : corev1.PodSpec {
146- InitContainers : []corev1.Container {
147- {
148- Name : "init-myservice" ,
149- Image : "busybox:1.28" ,
150- Command : []string {"sh" , "-c" , "until nslookup $RAY_IP.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done" },
151- },
152- },
153145 Containers : []corev1.Container {
154146 {
155147 Name : "ray-worker" ,
@@ -230,21 +222,29 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
230222 },
231223 Spec : rayv1.RayJobSpec {
232224 Entrypoint : "python /home/ray/jobs/mnist.py" ,
233- RuntimeEnv : base64 .StdEncoding .EncodeToString ([]byte (`
234- {
235- "pip": [
236- "pytorch_lightning==1.5.10",
237- "torchmetrics==0.9.1",
238- "torchvision==0.12.0"
239- ],
240- "env_vars": {
241- }
242- }
243- ` )),
225+ RuntimeEnvYAML : `
226+ pip:
227+ - pytorch_lightning==1.5.10
228+ - torchmetrics==0.9.1
229+ - torchvision==0.12.0
230+ env_vars:
231+ MNIST_DATASET_URL: "` + GetMnistDatasetURL () + `"
232+ ` ,
244233 ClusterSelector : map [string ]string {
245234 RayJobDefaultClusterSelectorKey : rayCluster .Name ,
246235 },
247236 ShutdownAfterJobFinishes : false ,
237+ SubmitterPodTemplate : & corev1.PodTemplateSpec {
238+ Spec : corev1.PodSpec {
239+ RestartPolicy : corev1 .RestartPolicyNever ,
240+ Containers : []corev1.Container {
241+ {
242+ Image : GetRayImage (),
243+ Name : "rayjob-submitter-pod" ,
244+ },
245+ },
246+ },
247+ },
248248 },
249249 }
250250 rayJob , err = test .Client ().Ray ().RayV1 ().RayJobs (namespace .Name ).Create (test .Ctx (), rayJob , metav1.CreateOptions {})
@@ -256,6 +256,10 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
256256 test .T ().Logf ("Connecting to Ray cluster at: %s" , rayDashboardURL .String ())
257257 rayClient := NewRayClusterClient (rayDashboardURL )
258258
259+ // Wait for Ray job id to be available, this value is needed for writing logs in defer
260+ test .Eventually (RayJob (test , rayJob .Namespace , rayJob .Name ), TestTimeoutShort ).
261+ Should (WithTransform (RayJobId , Not (BeEmpty ())))
262+
259263 // Retrieving the job logs once it has completed or timed out
260264 defer WriteRayJobAPILogs (test , rayClient , GetRayJobId (test , rayJob .Namespace , rayJob .Name ))
261265
0 commit comments