Slide 21
Slide 21 text
© ZOZO, Inc.
21
kfpの薄いwrapperライブラリの作成
● yamlからパイプラインのセットアップをできるように
○ 認証系の自動設定
○ バックエンドのGCSの設定
○ パイプライン引数の自動セットアップ
● CLIをサポートする
● Cloud Scheduler + Cloud Functionsでパイプラインを定期ス
ケジューリングできるように
# pipelines/example/__main__.py
from pipeline_lib import BasePipeline
from typing import Dict
from kfp.v2.dsl import component
import yaml
@component
def echoOp(message: str):
print(message)
class ExamplePipeline(BasePipeline):
def __init__(self, config: Dict):
super().__init__(config)
def pipeline(self):
echoOp("hello world")
if __name__ == "__main__":
with open('config/environment.yaml', encoding="utf-8") as f:
config = yaml.load(f, Loader=yaml.SafeLoader)
pipeline = ExamplePipeline(config)
pipeline.cli()
$ poetry run python pipelines/example run-pipeline --pipeline-name example --env dev
$ poetry run python pipelines/example schedule-pipeline --pipeline-name example --env dev