-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee85d11
commit f2d84ae
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
sdk/python/test_data/components/container_with_placeholder_in_fstring.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2022 The Kubeflow Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from kfp import dsl | ||
from kfp.dsl import Artifact | ||
from kfp.dsl import ContainerSpec | ||
from kfp.dsl import Output | ||
|
||
|
||
@dsl.container_component | ||
def container_with_placeholder_in_fstring( | ||
output_artifact: Output[Artifact], | ||
text1: str = 'text!', | ||
): | ||
return ContainerSpec( | ||
image='python:3.7', | ||
command=[ | ||
'my_program', | ||
f'prefix-{text1}', | ||
f'{output_artifact.uri}/0', | ||
]) | ||
|
||
|
||
if __name__ == '__main__': | ||
from kfp import compiler | ||
compiler.Compiler().compile( | ||
pipeline_func=container_with_placeholder_in_fstring, | ||
package_path=__file__.replace('.py', '.yaml')) |
46 changes: 46 additions & 0 deletions
46
sdk/python/test_data/components/container_with_placeholder_in_fstring.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
components: | ||
comp-container-with-placeholder-in-fstring: | ||
executorLabel: exec-container-with-placeholder-in-fstring | ||
inputDefinitions: | ||
parameters: | ||
text1: | ||
defaultValue: text! | ||
parameterType: STRING | ||
outputDefinitions: | ||
artifacts: | ||
output_artifact: | ||
artifactType: | ||
schemaTitle: system.Artifact | ||
schemaVersion: 0.0.1 | ||
deploymentSpec: | ||
executors: | ||
exec-container-with-placeholder-in-fstring: | ||
container: | ||
command: | ||
- my_program | ||
- prefix-{{$.inputs.parameters['text1']}} | ||
- '{{$.outputs.artifacts[''output_artifact''].uri}}/0' | ||
image: python:3.7 | ||
pipelineInfo: | ||
name: container-with-placeholder-in-fstring | ||
root: | ||
dag: | ||
tasks: | ||
container-with-placeholder-in-fstring: | ||
cachingOptions: | ||
enableCache: true | ||
componentRef: | ||
name: comp-container-with-placeholder-in-fstring | ||
inputs: | ||
parameters: | ||
text1: | ||
componentInputParameter: text1 | ||
taskInfo: | ||
name: container-with-placeholder-in-fstring | ||
inputDefinitions: | ||
parameters: | ||
text1: | ||
defaultValue: text! | ||
parameterType: STRING | ||
schemaVersion: 2.1.0 | ||
sdkVersion: kfp-2.0.0-beta.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters