-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - do not merge - support parameter inputs in kfp-kubernetes #71
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from kfp import dsl | ||
from kfp import kubernetes | ||
|
||
|
||
@dsl.component | ||
def comp(): | ||
pass | ||
|
||
@dsl.pipeline | ||
def my_pipeline(my_secret: str): | ||
task = comp() | ||
task.set_caching_options(False) | ||
|
||
kubernetes.use_secret_as_volume( | ||
task, | ||
secret_name=my_secret, | ||
mount_path='/mnt/my_secret', | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# PIPELINE DEFINITION | ||
# Name: my-pipeline | ||
# Inputs: | ||
# my_secret: str | ||
components: | ||
comp-comp: | ||
executorLabel: exec-comp | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
container: | ||
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.8.0'\ | ||
\ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ | ||
$0\" \"$@\"\n" | ||
- sh | ||
- -ec | ||
- 'program_path=$(mktemp -d) | ||
|
||
|
||
printf "%s" "$0" > "$program_path/ephemeral_component.py" | ||
|
||
_KFP_RUNTIME=true python3 -m kfp.dsl.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.8 | ||
pipelineInfo: | ||
name: my-pipeline | ||
root: | ||
dag: | ||
tasks: | ||
comp: | ||
cachingOptions: | ||
enableCache: false | ||
componentRef: | ||
name: comp-comp | ||
taskInfo: | ||
name: comp | ||
inputDefinitions: | ||
parameters: | ||
my_secret: | ||
parameterType: STRING | ||
schemaVersion: 2.1.0 | ||
sdkVersion: kfp-2.8.0 | ||
--- | ||
platforms: | ||
kubernetes: | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
secretAsVolume: | ||
- mountPath: /mnt/my_secret | ||
optional: false | ||
secretName: '{{my_secret}}' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from kfp import dsl | ||
from kfp import kubernetes | ||
|
||
|
||
@dsl.component | ||
def comp(): | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace
|
||
|
||
@dsl.pipeline | ||
def my_pipeline(my_secret: str = 'some-default-secret'): | ||
task = comp() | ||
task.set_caching_options(False) | ||
|
||
kubernetes.use_secret_as_volume( | ||
task, | ||
secret_name=my_secret, | ||
mount_path='/mnt/my_secret', | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# PIPELINE DEFINITION | ||
# Name: my-pipeline | ||
# Inputs: | ||
# my_secret: str [Default: 'some-default-secret'] | ||
components: | ||
comp-comp: | ||
executorLabel: exec-comp | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
container: | ||
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.8.0'\ | ||
\ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ | ||
$0\" \"$@\"\n" | ||
- sh | ||
- -ec | ||
- 'program_path=$(mktemp -d) | ||
|
||
|
||
printf "%s" "$0" > "$program_path/ephemeral_component.py" | ||
|
||
_KFP_RUNTIME=true python3 -m kfp.dsl.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.8 | ||
pipelineInfo: | ||
name: my-pipeline | ||
root: | ||
dag: | ||
tasks: | ||
comp: | ||
cachingOptions: | ||
enableCache: false | ||
componentRef: | ||
name: comp-comp | ||
taskInfo: | ||
name: comp | ||
inputDefinitions: | ||
parameters: | ||
my_secret: | ||
defaultValue: some-default-secret | ||
isOptional: true | ||
parameterType: STRING | ||
schemaVersion: 2.1.0 | ||
sdkVersion: kfp-2.8.0 | ||
--- | ||
platforms: | ||
kubernetes: | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
secretAsVolume: | ||
- mountPath: /mnt/my_secret | ||
optional: false | ||
secretName: '{{my_secret}}' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from kfp import dsl | ||
from kfp import kubernetes | ||
|
||
|
||
@dsl.component | ||
def comp(): | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace
|
||
|
||
@dsl.pipeline | ||
def my_pipeline(): | ||
task = comp() | ||
|
||
kubernetes.use_secret_as_volume( | ||
task, | ||
secret_name='my-hardcoded-secret', | ||
mount_path='/mnt/my_secret', | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# PIPELINE DEFINITION | ||
# Name: my-pipeline | ||
components: | ||
comp-comp: | ||
executorLabel: exec-comp | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
container: | ||
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.8.0'\ | ||
\ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' && \"\ | ||
$0\" \"$@\"\n" | ||
- sh | ||
- -ec | ||
- 'program_path=$(mktemp -d) | ||
|
||
|
||
printf "%s" "$0" > "$program_path/ephemeral_component.py" | ||
|
||
_KFP_RUNTIME=true python3 -m kfp.dsl.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.8 | ||
pipelineInfo: | ||
name: my-pipeline | ||
root: | ||
dag: | ||
tasks: | ||
comp: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-comp | ||
taskInfo: | ||
name: comp | ||
schemaVersion: 2.1.0 | ||
sdkVersion: kfp-2.8.0 | ||
--- | ||
platforms: | ||
kubernetes: | ||
deploymentSpec: | ||
executors: | ||
exec-comp: | ||
secretAsVolume: | ||
- mountPath: /mnt/my_secret | ||
optional: false | ||
secretName: my-hardcoded-secret |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from kfp import dsl | ||
from kfp import kubernetes | ||
|
||
|
||
@dsl.component | ||
def comp(): | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace
|
||
|
||
@dsl.pipeline | ||
def my_pipeline(): | ||
task = comp() | ||
|
||
my_secret = 'my-hardcoded-secret2' | ||
|
||
kubernetes.use_secret_as_volume( | ||
task, | ||
secret_name=my_secret, | ||
mount_path='/mnt/my_secret', | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.