Skip to content

Commit

Permalink
examples: Show the artifact decorator usage
Browse files Browse the repository at this point in the history
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com>
  • Loading branch information
Stefano Fioravanzo authored and elikatsis committed Apr 14, 2021
1 parent 78bf67d commit 394a5b5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/sdk/artifact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
This pipeline showcases how you can create a KFP artifact as part
of a step.
"""

from kale.sdk import pipeline, step, artifact


# Annotate the step with the @artifact decorator and specify the path to
# a HTML file
@artifact(name="test-artifact", path="/home/jovyan/myartifact.html")
@step(name="artifact_generator")
def generate_artifact():
print("Creating HTML artifact...")
with open("/home/jovyan/myartifact.html", "w") as f:
f.write("<html>Hello, World!<html>")
print("HTML artifact created successfully!")


@pipeline(name="generate-artifact", experiment="generate-artifact")
def artifact_pipeline():
generate_artifact()


if __name__ == "__main__":
artifact_pipeline()

0 comments on commit 394a5b5

Please # to comment.