kfp py func local
Kfp issue #7728
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 LocalClient
arguments = dict(a=1,b=2)
func_imports = ["from my_library import add_op"]
local_client = LocalClient()
local_client.create_run_from_pipeline_func(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.
Release files for kfp-py-func-local 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kfp-py-func-local-0.0.2.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kfp_py_func_local-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / kfp-py-func-local-0.0.2.tar.gz
| Download URL | kfp-py-func-local-0.0.2.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d05ae0f028b698f4c43d56bdbb458689123e27f110011161d6ad7d8cde98927b
|
|
BLAKE2b-256 checksum How to use checksums |
b1f0945501fb3684a2f3b90cd9a4689923e21c50d10c50aa20b9e5c5e095a7b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Release files / kfp_py_func_local-0.0.2-py3-none-any.whl
| Download URL | kfp_py_func_local-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abfd1d080cf93b55b7ceec9ca7cc0c93516d696dc15c13bec3f4ab3cfc5c8ba5
|
|
BLAKE2b-256 checksum How to use checksums |
59739d0b2a07a6e98575ad3eb769ed903181029889ea47bbdb61005853efc972
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|