Skip to content

Commit

Permalink
Fix backend test
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolovison committed Sep 2, 2024
1 parent b96c424 commit af3b9ec
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 51 deletions.
18 changes: 9 additions & 9 deletions backend/src/cache/server/mutation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var (
Command: []string{"python"},
Env: []corev1.EnvVar{{
Name: ArgoWorkflowTemplateEnvKey,
Value: `{"name": "Does not matter","container":{"command":["echo", "Hello"],"image":"python:3.7"}}`,
Value: `{"name": "Does not matter","container":{"command":["echo", "Hello"],"image":"python:3.9"}}`,
}},
},
},
Expand Down Expand Up @@ -169,9 +169,9 @@ func TestMutatePodIfCached(t *testing.T) {

func TestMutatePodIfCachedWithCacheEntryExist(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "f5fe913be7a4516ebfe1b5de29bcb35edd12ecc776b2f33f10ca19709ea3b2f0",
ExecutionCacheKey: "1933d178a14bc415466cfd1b3ca2100af975e8c59e1ff9d502fcf18eb5cbd7f7",
ExecutionOutput: "testOutput",
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.7"}}`,
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.9"}}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)
Expand All @@ -188,9 +188,9 @@ func TestMutatePodIfCachedWithCacheEntryExist(t *testing.T) {

func TestDefaultImage(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "f5fe913be7a4516ebfe1b5de29bcb35edd12ecc776b2f33f10ca19709ea3b2f0",
ExecutionCacheKey: "1933d178a14bc415466cfd1b3ca2100af975e8c59e1ff9d502fcf18eb5cbd7f7",
ExecutionOutput: "testOutput",
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.7"}}`,
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.9"}}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)
Expand All @@ -209,7 +209,7 @@ func TestSetImage(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "f5fe913be7a4516ebfe1b5de29bcb35edd12ecc776b2f33f10ca19709ea3b2f0",
ExecutionOutput: "testOutput",
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.7"}}`,
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.9"}}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)
Expand All @@ -226,7 +226,7 @@ func TestCacheNodeRestriction(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "f5fe913be7a4516ebfe1b5de29bcb35edd12ecc776b2f33f10ca19709ea3b2f0",
ExecutionOutput: "testOutput",
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.7"},"nodeSelector":{"disktype":"ssd"}}`,
ExecutionTemplate: `{"container":{"command":["echo", "Hello"],"image":"python:3.9"},"nodeSelector":{"disktype":"ssd"}}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)
Expand All @@ -239,9 +239,9 @@ func TestCacheNodeRestriction(t *testing.T) {

func TestMutatePodIfCachedWithTeamplateCleanup(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "5a20e3f2e74863b363291953082d9812a58e25f7117bface1c76d40ef0ee88fc",
ExecutionCacheKey: "c81988503d55a5817d79bd972017d95c37f72b024e522b4d79787d9f599c0725",
ExecutionOutput: "testOutput",
ExecutionTemplate: `Cache key was calculated from this: {"container":{"command":["echo", "Hello"],"image":"python:3.7"},"outputs":"anything"}`,
ExecutionTemplate: `Cache key was calculated from this: {"container":{"command":["echo", "Hello"],"image":"python:3.9"},"outputs":"anything"}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ spec:
parameters:
- name: kubernetes-comp-comp
value: '{"pvcMount":[{"mountPath":"/data","taskOutputParameter":{"outputParameterKey":"name","producerTask":"createpvc"}}]}'
- name: components-95f802401136aebf1bf728a6675d7adba5513b53673a3698e00a6d8744638080
- name: components-b34273359995b3746ecf1bb58ac4bd6c54d47b6fdc35b013bb7962946f322a19
value: '{"executorLabel":"exec-comp"}'
- name: implementations-95f802401136aebf1bf728a6675d7adba5513b53673a3698e00a6d8744638080
- name: implementations-b34273359995b3746ecf1bb58ac4bd6c54d47b6fdc35b013bb7962946f322a19
value: '{"args":["--executor_input","{{$}}","--function_to_execute","comp"],"command":["sh","-c","\nif
! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip || python3
-m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1
python3 -m pip install --quiet --no-warn-script-location ''kfp==2.0.0-beta.16''
\u0026\u0026 \"$0\" \"$@\"\n","sh","-ec","program_path=$(mktemp -d) printf
\"%s\" \"$0\" \u003e \"$program_path/ephemeral_component.py\" python3 -m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"
","\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import
*\n\ndef comp():\n pass\n\n"],"image":"python:3.7"}'
*\n\ndef comp():\n pass\n\n"],"image":"python:3.9"}'
- name: kubernetes-comp-comp-2
value: '{"pvcMount":[{"mountPath":"/reused_data","taskOutputParameter":{"outputParameterKey":"name","producerTask":"createpvc"}}]}'
- name: components-98f254581598234b59377784d6cbf209de79e0bcda8013fe4c4397b5d3a26767
Expand Down Expand Up @@ -197,11 +197,11 @@ spec:
- arguments:
parameters:
- name: component
value: '{{workflow.parameters.components-95f802401136aebf1bf728a6675d7adba5513b53673a3698e00a6d8744638080}}'
value: '{{workflow.parameters.components-b34273359995b3746ecf1bb58ac4bd6c54d47b6fdc35b013bb7962946f322a19}}'
- name: task
value: '{"cachingOptions":{"enableCache":true},"componentRef":{"name":"comp-comp"},"dependentTasks":["createpvc"],"taskInfo":{"name":"comp"}}'
- name: container
value: '{{workflow.parameters.implementations-95f802401136aebf1bf728a6675d7adba5513b53673a3698e00a6d8744638080}}'
value: '{{workflow.parameters.implementations-b34273359995b3746ecf1bb58ac4bd6c54d47b6fdc35b013bb7962946f322a19}}'
- name: parent-dag-id
value: '{{inputs.parameters.parent-dag-id}}'
- name: kubernetes-config
Expand All @@ -222,11 +222,11 @@ spec:
- arguments:
parameters:
- name: component
value: '{{workflow.parameters.components-95f802401136aebf1bf728a6675d7adba5513b53673a3698e00a6d8744638080}}'
value: '{{workflow.parameters.components-b34273359995b3746ecf1bb58ac4bd6c54d47b6fdc35b013bb7962946f322a19}}'
- name: task
value: '{"cachingOptions":{"enableCache":true},"componentRef":{"name":"comp-comp-2"},"dependentTasks":["comp","createpvc"],"taskInfo":{"name":"comp-2"}}'
- name: container
value: '{{workflow.parameters.implementations-95f802401136aebf1bf728a6675d7adba5513b53673a3698e00a6d8744638080}}'
value: '{{workflow.parameters.implementations-b34273359995b3746ecf1bb58ac4bd6c54d47b6fdc35b013bb7962946f322a19}}'
- name: parent-dag-id
value: '{{inputs.parameters.parent-dag-id}}'
- name: kubernetes-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ spec:
parameters:
- name: kubernetes-comp-hello-world
value: '{"podMetadata":{"annotations":{"experiment_id":"234567","run_id":"123456"},"labels":{"kubeflow.com/common":"test","kubeflow.com/kfp":"pipeline-node"}}}'
- name: components-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390
- name: components-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7
value: '{"executorLabel":"exec-hello-world","inputDefinitions":{"parameters":{"text":{"type":"STRING"}}}}'
- name: implementations-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390
- name: implementations-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7
value: '{"args":["--text","{{$.inputs.parameters[''text'']}}"],"command":["sh","-ec","program_path=$(mktemp)\nprintf
\"%s\" \"$0\" \u003e \"$program_path\"\npython3 -u \"$program_path\" \"$@\"\n","def
hello_world(text):\n print(text)\n return text\n\nimport argparse\n_parser
= argparse.ArgumentParser(prog=''Hello world'', description='''')\n_parser.add_argument(\"--text\",
dest=\"text\", type=str, required=True, default=argparse.SUPPRESS)\n_parsed_args
= vars(_parser.parse_args())\n\n_outputs = hello_world(**_parsed_args)\n"],"image":"python:3.7"}'
= vars(_parser.parse_args())\n\n_outputs = hello_world(**_parsed_args)\n"],"image":"python:3.9"}'
- name: components-root
value: '{"dag":{"tasks":{"hello-world":{"cachingOptions":{"enableCache":true},"componentRef":{"name":"comp-hello-world"},"inputs":{"parameters":{"text":{"componentInputParameter":"text"}}},"taskInfo":{"name":"hello-world"}}}},"inputDefinitions":{"parameters":{"text":{"type":"STRING"}}}}'
entrypoint: entrypoint
Expand Down Expand Up @@ -191,11 +191,11 @@ spec:
- arguments:
parameters:
- name: component
value: '{{workflow.parameters.components-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390}}'
value: '{{workflow.parameters.components-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7}}'
- name: task
value: '{"cachingOptions":{"enableCache":true},"componentRef":{"name":"comp-hello-world"},"inputs":{"parameters":{"text":{"componentInputParameter":"text"}}},"taskInfo":{"name":"hello-world"}}'
- name: container
value: '{{workflow.parameters.implementations-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390}}'
value: '{{workflow.parameters.implementations-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7}}'
- name: parent-dag-id
value: '{{inputs.parameters.parent-dag-id}}'
- name: kubernetes-config
Expand Down
10 changes: 5 additions & 5 deletions backend/src/v2/compiler/argocompiler/testdata/hello_world.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ metadata:
spec:
arguments:
parameters:
- name: components-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390
- name: components-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7
value: '{"executorLabel":"exec-hello-world","inputDefinitions":{"parameters":{"text":{"type":"STRING"}}}}'
- name: implementations-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390
- name: implementations-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7
value: '{"args":["--text","{{$.inputs.parameters[''text'']}}"],"command":["sh","-ec","program_path=$(mktemp)\nprintf
\"%s\" \"$0\" \u003e \"$program_path\"\npython3 -u \"$program_path\" \"$@\"\n","def
hello_world(text):\n print(text)\n return text\n\nimport argparse\n_parser
= argparse.ArgumentParser(prog=''Hello world'', description='''')\n_parser.add_argument(\"--text\",
dest=\"text\", type=str, required=True, default=argparse.SUPPRESS)\n_parsed_args
= vars(_parser.parse_args())\n\n_outputs = hello_world(**_parsed_args)\n"],"image":"python:3.7"}'
= vars(_parser.parse_args())\n\n_outputs = hello_world(**_parsed_args)\n"],"image":"python:3.9"}'
- name: components-root
value: '{"dag":{"tasks":{"hello-world":{"cachingOptions":{"enableCache":true},"componentRef":{"name":"comp-hello-world"},"inputs":{"parameters":{"text":{"componentInputParameter":"text"}}},"taskInfo":{"name":"hello-world"}}}},"inputDefinitions":{"parameters":{"text":{"type":"STRING"}}}}'
entrypoint: entrypoint
Expand Down Expand Up @@ -183,11 +183,11 @@ spec:
- arguments:
parameters:
- name: component
value: '{{workflow.parameters.components-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390}}'
value: '{{workflow.parameters.components-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7}}'
- name: task
value: '{"cachingOptions":{"enableCache":true},"componentRef":{"name":"comp-hello-world"},"inputs":{"parameters":{"text":{"componentInputParameter":"text"}}},"taskInfo":{"name":"hello-world"}}'
- name: container
value: '{{workflow.parameters.implementations-34e222d692a0573c88000b8cb02ad24423491a53e061e9bba36d3718dd4c3390}}'
value: '{{workflow.parameters.implementations-203fce8adabe0cfa7da54b9d3ff79c772136c926974659b51c378727c7ccdfb7}}'
- name: parent-dag-id
value: '{{inputs.parameters.parent-dag-id}}'
name: hello-world-driver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
-d)\nprintf \"%s\" \"$0\" \u003e \"$program_path/ephemeral_component.py\"\npython3
-m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n","\nimport
kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import
*\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n"],"image":"python:3.7"}'
*\n\ndef print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down Expand Up @@ -210,7 +210,7 @@ spec:
\"%s\" \"$0\" \u003e \"$program_path/ephemeral_component.py\"\npython3 -m
kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n","\nimport
kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef
fail_op(message: str):\n \"\"\"Fails.\"\"\"\n import sys\n print(message)\n sys.exit(1)\n\n"],"image":"python:3.7"}'
fail_op(message: str):\n \"\"\"Fails.\"\"\"\n import sys\n print(message)\n sys.exit(1)\n\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down Expand Up @@ -352,7 +352,7 @@ spec:
\"%s\" \"$0\" \u003e \"$program_path/ephemeral_component.py\"\npython3 -m
kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n","\nimport
kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef
print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n"],"image":"python:3.7"}'
print_op(message: str):\n \"\"\"Prints a message.\"\"\"\n print(message)\n\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
hello_world(text):\n print(text)\n return text\n\nimport argparse\n_parser
= argparse.ArgumentParser(prog=''Hello world'', description='''')\n_parser.add_argument(\"--text\",
dest=\"text\", type=str, required=True, default=argparse.SUPPRESS)\n_parsed_args
= vars(_parser.parse_args())\n\n_outputs = hello_world(**_parsed_args)\n"],"image":"python:3.7"}'
= vars(_parser.parse_args())\n\n_outputs = hello_world(**_parsed_args)\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
-m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n","\nimport
kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import
*\n\ndef concat_op(a: str, b: str) -\u003e str:\n print(a + b)\n return
a + b\n\n"],"image":"python:3.7"}'
a + b\n\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down Expand Up @@ -219,7 +219,7 @@ spec:
-m kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n","\nimport
kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import
*\n\ndef print_op(text: str) -\u003e str:\n print(text)\n return
text\n\n"],"image":"python:3.7"}'
text\n\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down Expand Up @@ -406,7 +406,7 @@ spec:
\"%s\" \"$0\" \u003e \"$program_path/ephemeral_component.py\"\npython3 -m
kfp.components.executor_main --component_module_path \"$program_path/ephemeral_component.py\" \"$@\"\n","\nimport
kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef
print_op(text: str) -\u003e str:\n print(text)\n return text\n\n"],"image":"python:3.7"}'
print_op(text: str) -\u003e str:\n print(text)\n return text\n\n"],"image":"python:3.9"}'
- name: iteration-index
value: ""
- name: kubernetes-config
Expand Down
Loading

0 comments on commit af3b9ec

Please sign in to comment.