Last active
November 11, 2023 16:13
-
-
Save ftnext/9dd64bd49bb1443c0eda4734a2a18a7f to your computer and use it in GitHub Desktop.
ref: https://nikkie-ftnext.hatenablog.com/entry/getting-started-kubeflow-pipelines-with-simple-samples
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
# See https://gist.github.com/ftnext/4b87d23d1671bb45e2fa3bf2dcce2739 | |
from kfp import compiler, dsl | |
from kfp.components import func_to_container_op | |
@func_to_container_op | |
def print_op(message: str): | |
print(message) | |
@func_to_container_op | |
def fail_op(message: str): | |
import sys | |
print(message) | |
sys.exit(1) | |
@dsl.pipeline( | |
name="tutorial-control-flows-exithandler", | |
description="This example fails. Use kfp.dsl.ExitHandler", | |
) | |
def control_flows_pipeline(): | |
start_print_task = print_op("Pipeline start") | |
fail_task = fail_op("This fails!").after(start_print_task) | |
end_print_task = print_op("Pipeline end").after(fail_task) | |
if __name__ == "__main__": | |
compiler.Compiler().compile(control_flows_pipeline, __file__ + ".yaml") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment