Skip to content

Commit 1445fa6

Browse files
Fix issues with templates in KFTO SDK test
1 parent 572ef18 commit 1445fa6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

tests/common/notebook.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package common
1919
import (
2020
"bytes"
2121
"embed"
22+
"strings"
2223

2324
gomega "github.com/onsi/gomega"
2425
. "github.com/project-codeflare/codeflare-common/support"
@@ -53,7 +54,7 @@ type NotebookProps struct {
5354
KubernetesUserBearerToken string
5455
Namespace string
5556
OpenDataHubNamespace string
56-
Command []string
57+
Command string
5758
NotebookImage string
5859
NotebookConfigMapName string
5960
NotebookConfigMapFileName string
@@ -76,6 +77,7 @@ func CreateNotebook(test Test, namespace *corev1.Namespace, notebookUserToken st
7677
s3SecretAccessKey, _ := GetStorageBucketSecretKey()
7778
s3Endpoint, _ := GetStorageBucketDefaultEndpoint()
7879
s3DefaultRegion, _ := GetStorageBucketDefaultRegion()
80+
strCommand := "[\"" + strings.Join(command, "\",\"") + "\"]"
7981

8082
if !s3BucketNameExists {
8183
s3BucketName = "''"
@@ -92,7 +94,7 @@ func CreateNotebook(test Test, namespace *corev1.Namespace, notebookUserToken st
9294
KubernetesUserBearerToken: notebookUserToken,
9395
Namespace: namespace.Name,
9496
OpenDataHubNamespace: GetOpenDataHubNamespace(test),
95-
Command: command,
97+
Command: strCommand,
9698
NotebookImage: GetNotebookImage(test),
9799
NotebookConfigMapName: jupyterNotebookConfigMapName,
98100
NotebookConfigMapFileName: jupyterNotebookConfigMapFileName,
@@ -109,6 +111,7 @@ func CreateNotebook(test Test, namespace *corev1.Namespace, notebookUserToken st
109111
notebookTemplate, err := files.ReadFile("resources/custom-nb-small.yaml")
110112
test.Expect(err).NotTo(gomega.HaveOccurred())
111113

114+
notebookTemplate = ParseTemplate(test, notebookTemplate, notebookProps)
112115
parsedNotebookTemplate := ParseTemplate(test, notebookTemplate, notebookProps)
113116

114117
// Create Notebook CR

tests/kfto/kfto_mnist_sdk_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ func TestMnistSDK(t *testing.T) {
6060
})
6161

6262
notebookCommand := []string{
63-
"bin/sh",
63+
"/bin/sh",
6464
"-c",
6565
"pip install papermill && papermill /opt/app-root/notebooks/{{.NotebookConfigMapFileName}}" +
6666
" /opt/app-root/src/mcad-out.ipynb -p namespace {{.Namespace}} -p openshift_api_url {{.OpenShiftApiUrl}}" +
6767
" -p kubernetes_user_bearer_token {{.KubernetesUserBearerToken}}" +
68-
" -p num_gpus {{ .NumGpus }} --log-output && sleep infinity",
68+
" -p num_gpus {{.NumGpus}} --log-output && sleep infinity",
6969
}
7070
// Create Notebook CR
7171
CreateNotebook(test, namespace, userToken, notebookCommand, config.Name, jupyterNotebookConfigMapFileName, 0)

tests/kfto/resources/mnist_kfto.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
" name=\"pytorch-ddp\",\n",
5656
" namespace=namespace,\n",
5757
" train_func=train_func,\n",
58-
" num_workers=2,\n",
58+
" num_workers=1,\n",
5959
" resources_per_worker={\"gpu\": num_gpus},\n",
6060
" base_image=\"quay.io/kpostlet/torch-train:with-minivision\",\n",
6161
" # packages_to_install=[\"torchvision==0.19.0\", \"--target=/tmp/lib\"],\n",

0 commit comments

Comments
 (0)