Skip to content

Commit 890c82b

Browse files
update
1 parent c18cc95 commit 890c82b

File tree

9 files changed

+53
-8874
lines changed

9 files changed

+53
-8874
lines changed

tests/odh/notebook.go

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package odh
1818

1919
import (
2020
"bytes"
21-
"os"
2221

2322
gomega "github.com/onsi/gomega"
2423
. "github.com/project-codeflare/codeflare-common/support"
@@ -61,6 +60,7 @@ func createNotebook(test Test, namespace *corev1.Namespace, notebookUserToken, j
6160
s3BucketName, _ := GetStorageBucketName()
6261
s3AccessKeyId, _ := GetStorageBucketAccessKeyId()
6362
s3SecretAccessKey, _ := GetStorageBucketSecretKey()
63+
s3DefaultRegion, _ := GetStorageBucketDefaultRegion()
6464

6565
// Read the Notebook CR from resources and perform replacements for custom values using go template
6666
notebookProps := NotebookProps{
@@ -78,45 +78,7 @@ func createNotebook(test Test, namespace *corev1.Namespace, notebookUserToken, j
7878
S3BucketName: s3BucketName,
7979
S3AccessKeyId: s3AccessKeyId,
8080
S3SecretAccessKey: s3SecretAccessKey,
81-
S3DefaultRegion: GetS3DefaultRegion(),
82-
}
83-
notebookTemplate, err := files.ReadFile("resources/custom-nb-small.yaml")
84-
test.Expect(err).NotTo(gomega.HaveOccurred())
85-
86-
parsedNotebookTemplate := ParseTemplate(test, notebookTemplate, notebookProps)
87-
88-
// Create Notebook CR
89-
notebookCR := &unstructured.Unstructured{}
90-
err = yaml.NewYAMLOrJSONDecoder(bytes.NewBuffer(parsedNotebookTemplate), 8192).Decode(notebookCR)
91-
test.Expect(err).NotTo(gomega.HaveOccurred())
92-
_, err = test.Client().Dynamic().Resource(notebookResource).Namespace(namespace.Name).Create(test.Ctx(), notebookCR, metav1.CreateOptions{})
93-
test.Expect(err).NotTo(gomega.HaveOccurred())
94-
}
95-
96-
func createNotebookWithPvc(test Test, namespace *corev1.Namespace, notebookUserToken, jupyterNotebookConfigMapName, jupyterNotebookConfigMapFileName string, numGpus int) {
97-
// Create PVC for Notebook
98-
notebookPVC := CreatePersistentVolumeClaim(test, namespace.Name, "10Gi", corev1.ReadWriteOnce)
99-
s3BucketName, _ := GetStorageBucketName()
100-
s3AccessKeyId, _ := GetStorageBucketAccessKeyId()
101-
s3SecretAccessKey, _ := GetStorageBucketSecretKey()
102-
103-
// Read the Notebook CR from resources and perform replacements for custom values using go template
104-
notebookProps := NotebookProps{
105-
IngressDomain: GetOpenShiftIngressDomain(test),
106-
OpenShiftApiUrl: GetOpenShiftApiUrl(test),
107-
KubernetesUserBearerToken: notebookUserToken,
108-
Namespace: namespace.Name,
109-
OpenDataHubNamespace: GetOpenDataHubNamespace(test),
110-
RayImage: GetRayImage(),
111-
NotebookImage: GetNotebookImage(test),
112-
NotebookConfigMapName: jupyterNotebookConfigMapName,
113-
NotebookConfigMapFileName: jupyterNotebookConfigMapFileName,
114-
NotebookPVC: notebookPVC.Name,
115-
NumGpus: numGpus,
116-
S3BucketName: s3BucketName,
117-
S3AccessKeyId: s3AccessKeyId,
118-
S3SecretAccessKey: s3SecretAccessKey,
119-
S3DefaultRegion: GetS3DefaultRegion(),
81+
S3DefaultRegion: s3DefaultRegion,
12082
}
12183
notebookTemplate, err := files.ReadFile("resources/custom-nb-small.yaml")
12284
test.Expect(err).NotTo(gomega.HaveOccurred())
@@ -147,7 +109,3 @@ func listNotebooks(test Test, namespace *corev1.Namespace) []*unstructured.Unstr
147109

148110
return ntbsp
149111
}
150-
151-
func GetS3DefaultRegion() string {
152-
return os.Getenv("AWS_DEFAULT_REGION")
153-
}

tests/odh/mnist_ray_finetune_test.go renamed to tests/odh/ray_finetune_llm_deepspeed_test.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func mnistRayLlmFinetune(t *testing.T, numGpus int) {
3232
test := With(t)
3333

3434
// Create a namespace
35-
namespace := CreateTestNamespaceWithName(test, "ray-finetune-llm-deepspeed")
35+
namespace := test.NewTestNamespace()
3636

3737
// Test configuration
3838
jupyterNotebookConfigMapFileName := "ray_finetune_llm_deepspeed.ipynb"
@@ -64,11 +64,11 @@ func mnistRayLlmFinetune(t *testing.T, numGpus int) {
6464
// Gracefully cleanup Notebook
6565
defer func() {
6666
deleteNotebook(test, namespace)
67-
test.Eventually(listNotebooks(test, namespace), TestTimeoutMedium).Should(HaveLen(0))
67+
test.Eventually(listNotebooks(test, namespace), TestTimeoutGpuProvisioning).Should(HaveLen(0))
6868
}()
6969

7070
// Make sure the RayCluster is created and running
71-
test.Eventually(RayClusters(test, namespace.Name), TestTimeoutLong).
71+
test.Eventually(RayClusters(test, namespace.Name), TestTimeoutGpuProvisioning).
7272
Should(
7373
And(
7474
HaveLen(1),
@@ -77,13 +77,26 @@ func mnistRayLlmFinetune(t *testing.T, numGpus int) {
7777
)
7878

7979
// Make sure the RayCluster finishes and is deleted
80-
test.Eventually(RayClusters(test, namespace.Name), TestTimeoutLong).
80+
test.Eventually(RayClusters(test, namespace.Name), TestTimeoutGpuProvisioning).
8181
Should(HaveLen(0))
8282
}
8383

8484
func ReadRayFinetuneRequirementsTxt(test Test) []byte {
85+
// Read the requirements.txt from resources and perform replacements for custom values using go template
86+
props := struct {
87+
PipIndexUrl string
88+
PipTrustedHost string
89+
}{
90+
PipIndexUrl: "--index " + string(GetPipIndexURL()),
91+
}
92+
93+
// Provide trusted host only if defined
94+
if len(GetPipTrustedHost()) > 0 {
95+
props.PipTrustedHost = "--trusted-host " + GetPipTrustedHost()
96+
}
97+
8598
template, err := files.ReadFile("resources/ray_finetune_demo/ray_finetune_requirements.txt")
8699
test.Expect(err).NotTo(HaveOccurred())
87100

88-
return template
101+
return ParseTemplate(test, template, props)
89102
}

tests/odh/resources/ray_finetune_demo/create_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import os
44

5-
dataset = load_dataset("gsm8k", "main", cache_dir="../../datasets")
5+
dataset = load_dataset("gsm8k", "main")
66

77
dataset_splits = {"train": dataset["train"], "test": dataset["test"]}
88

0 commit comments

Comments
 (0)