kfp.local

The kfp.local module contains objects for running KFP components locally.

Functions:

init(runner[, pipeline_root, raise_on_error])

Initializes a local execution session.

Classes:

SubprocessRunner([use_venv])

Runner that indicates that local tasks should be run in a subprocess.

DockerRunner()

Runner that indicates that local tasks should be run as a Docker container.

kfp.local.init(runner: SubprocessRunner | DockerRunner, pipeline_root: str = './local_outputs', raise_on_error: bool = True) None[source]

Initializes a local execution session.

Once called, components can be invoked locally outside of a pipeline definition.

Parameters
runner: SubprocessRunner | DockerRunner

The runner to use. Supported runners: kfp.local.SubprocessRunner and kfp.local.DockerRunner.

pipeline_root: str = './local_outputs'

Destination for task outputs.

raise_on_error: bool = True

If True, raises an exception when a local task execution fails. If False, fails gracefully and does not terminate the current program.

class kfp.local.SubprocessRunner(use_venv: bool = True)[source]

Bases: object

Runner that indicates that local tasks should be run in a subprocess.

Parameters
use_venv: bool = True

Whether to run the subprocess in a virtual environment. If True, dependencies will be installed in the virtual environment. If False, dependencies will be installed in the current environment. Using a virtual environment is recommended.

Attributes:

use_venv

use_venv : bool = True
class kfp.local.DockerRunner[source]

Bases: object

Runner that indicates that local tasks should be run as a Docker container.