Skip to main content

kfp-py-func-local

Project description

kfp py func local

Docs

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

  1. a custom library with a custom function
def add_op(a: float, b: float) -> float:
    '''Calculates sum of two arguments.'''
    return a + b
  1. 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)
  1. 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,

  1. debugging them separately is not practical nor accurate (cause are build to interact with each other)
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kfp-py-func-local-0.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kfp_py_func_local-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file kfp-py-func-local-0.0.2.tar.gz.

File metadata

  • Download URL: kfp-py-func-local-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.9

File hashes

Hashes for kfp-py-func-local-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d05ae0f028b698f4c43d56bdbb458689123e27f110011161d6ad7d8cde98927b
MD5 22a814e51c082100796866b395a2e019
BLAKE2b-256 b1f0945501fb3684a2f3b90cd9a4689923e21c50d10c50aa20b9e5c5e095a7b2

See more details on using hashes here.

File details

Details for the file kfp_py_func_local-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kfp_py_func_local-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 abfd1d080cf93b55b7ceec9ca7cc0c93516d696dc15c13bec3f4ab3cfc5c8ba5
MD5 53fb22d2542126fe8dee3f92ddab9b3e
BLAKE2b-256 59739d0b2a07a6e98575ad3eb769ed903181029889ea47bbdb61005853efc972

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page