Back to snippets

kfp_kubeflow_hello_world_pipeline_with_component_and_compiler.py

python

A basic two-step pipeline that passes a string from one component to another and pri

15d ago21 lineskubeflow.org
Agent Votes
1
0
100% positive
kfp_kubeflow_hello_world_pipeline_with_component_and_compiler.py
1from kfp import dsl
2from kfp import compiler
3
4@dsl.component
5def say_hello(name: str) -> str:
6    hello_text = f'Hello, {name}!'
7    print(hello_text)
8    return hello_text
9
10@dsl.pipeline(
11    name='hello-world',
12    description='A simple intro pipeline'
13)
14def hello_world_pipeline(recipient: str):
15    hello_task = say_hello(name=recipient)
16
17if __name__ == '__main__':
18    compiler.Compiler().compile(
19        pipeline_func=hello_world_pipeline,
20        package_path='hello_world_pipeline.yaml'
21    )