kfp-py-func-local
Project description
kfp local
Utils to run 'kfp-pipeline' with only py-function components in local without kubernetes & docker build.
Main purpose is to debug faster in early stages.
Getting Started
Install:
pip install kfp-py-func-local
Assume you have
- a custom library with a custom function
def add_op(a: float, b: float) -> float:
'''Calculates sum of two arguments.'''
return a + b
- a kfp component based on the function
from kfp.v2.dsl import component
@component(base_image=custom_image_with_my_library_installed)
def add_op(a: float, b: float) -> float:
kwargs = locals()
from my_library import add_op
return add_op(**kwargs)
- a kfp pipeline using the kfp component
@pipeline
def add_pipeline(
a: float = 1,
b: float = 7
):
first_add_task = add_op(a, 4)
second_add_task = add_op(first_add_task.output, b)
Then you would push your image custom_image_with_my_library_installed
to a container registry.
And compile it to a yaml
to then run it in top of a kubernetes.
With kfp-local
you can avoid this, and run your code locally on your computer doing
from kfp_local import create_run_from_pipeline_func_locally
arguments = dict(a=1,b=2)
func_imports = ["from my_library import add_op"]
create_run_from_pipeline_func_locally(add_pipeline, arguments=arguments, func_imports=func_imports)
Why run locally a kubernetes orchestrator?
Here we're assuming that all components are based on custom-made functions. To debug those,
- debugging them separately is not practical nor accurate (cause are build to interact with each other)
- create (and mantain) 2 pipelines, one for local and other for kubeflow is painful and error pruning
Typical usage of kfp-local
would be to debug your custom code locally with very few data samples.
Check that code works fine, and then run it in kubernetes with all samples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for kfp_py_func_local-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03d8bf59165cf9f385f7f58c37b95e5906d326dd058a659692422f14b55e907e |
|
MD5 | 40735a6250647810fefc68808e779343 |
|
BLAKE2b-256 | 7ea4c7c7b6f9426974ad23b29cf338de4d851fac59feaff71eb96a9536751f1a |