-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: Show the artifact decorator usage
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> Reviewed-by: Ilias Katsakioris <elikatsis@arrikto.com>
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
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,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() |