Skip to main content

Kubeflow Pipeline extension for Metaflow

Project description

Kubeflow Pipelines extension for Metaflow

Compile and run Metaflow flows on Kubeflow Pipelines (argo workflows backend).

Basic Usage

  • Have access to a Kubeflow Pipelines instance with the API server URL.
  • Use the CLI commands to compile your flow into a Kubeflow Pipeline and deploy it.

Youtube Screencast

metaflow kubeflow demo

Compiling and Deploying a Pipeline

python my_flow.py kubeflow-pipelines create \
    --url https://my-kubeflow-instance.com

This command will:

  • Compile your Metaflow flow into a Kubeflow Pipeline YAML specification
  • Upload it to your Kubeflow Pipelines instance
  • Create a new version of the pipeline

Accessing Kubeflow Pipelines for Deployment

Metaflow needs to be able to connect to Kubeflow Pipelines for deployment. If you have connectivity already set up, you don't need to do anything.

If you can't connect to the service directly, you can set up a port forward to the service:

kubectl port-forward -n kubeflow svc/ml-pipeline-ui 8081:80

After this, you can specify the service URL as http://localhost:8081 in one of these ways:

  • On the CLI for kubeflow-pipelines commands with the --url option
  • In the Metaflow config, specify "METAFLOW_KUBEFLOW_PIPELINES_URL": "http://localhost:8081"
  • Set an environment variable, METAFLOW_KUBEFLOW_PIPELINES_URL=http://localhost:8081

Available Commands

1. create - Compile and/or Deploy Pipeline

Compile a new version of your flow to Kubeflow Pipelines:

Recurring Runs: If your flow is decorated with @schedule, this command will automatically create or update the corresponding Recurring Run in Kubeflow Pipelines.

python my_flow.py kubeflow-pipelines create \
    --url https://my-kubeflow-instance.com \
    --version-name v1.0.0 \
    --experiment "My Production Experiment" \
    --alpha 0.5

Options:

  • --experiment: The experiment name to create the recurring run under (if @schedule is present). Defaults to "Default".
  • --version-name: Allows one to deploy a custom version name. Else, a new version with UTC timestamp is created.
  • --yaml-only: Export the YAML file without uploading to Kubeflow Pipelines.
  • Flow Parameters: Any flow parameters (e.g., --alpha) passed here will be baked into the recurring run configuration (if @schedule is present), overriding the defaults defined in your code.

Use --help for all available options including tags, namespace, max-workers, and production token management.

2. trigger - Execute Pipeline

Trigger an execution of your deployed pipeline:

python my_flow.py kubeflow-pipelines trigger \
    --url https://my-kubeflow-instance.com \
    --experiment my-experiment \
    --alpha 0.1 \
    --max-epochs 100

Flow parameters can be passed as command-line arguments. Use --help for all available options.

By default, the latest version of the deployed pipeline is used for the trigger. Else, one can also pass in a custom version using --version-name.

3. status - Check Execution Status

Fetch the status of a running or completed pipeline execution:

python my_flow.py kubeflow-pipelines status \
    --url https://my-kubeflow-instance.com \
    --kfp-run-id abc-123-def-456

Use --help for all available options.

4. terminate - Terminate Execution

Terminate a running pipeline execution:

python my_flow.py kubeflow-pipelines terminate \
    --url https://my-kubeflow-instance.com \
    --kfp-run-id abc-123-def-456

Use --help for all available options.

5. delete - Delete a Deployed Pipeline

Delete the flow definition and all its associated versions from Kubeflow Pipelines.

This command also searches for and deletes any associated Recurring Runs (Schedules) to ensure no orphaned schedules continue trying to trigger deleted pipelines.

In essence, this undeploys the pipeline but preserves execution history (runs) and artifacts.

python my_flow.py kubeflow-pipelines delete \
    --url https://my-kubeflow-instance.com \

Use --help for all available options.

Fin.

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

metaflow_kubeflow-0.0.2.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

metaflow_kubeflow-0.0.2-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file metaflow_kubeflow-0.0.2.tar.gz.

File metadata

  • Download URL: metaflow_kubeflow-0.0.2.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metaflow_kubeflow-0.0.2.tar.gz
Algorithm Hash digest
SHA256 da30b54520cedd6b3bd101ecc4b07e87d92d73608e8acc584678a7f6ba1b3d33
MD5 6c664d16f7361351d838b33ee2c03f77
BLAKE2b-256 e2f8aaff13f9ed723d93856e386f10cfefbf5148c82c344f775e8dd4cdb48422

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaflow_kubeflow-0.0.2.tar.gz:

Publisher: publish.yml on outerbounds/metaflow-kubeflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for metaflow_kubeflow-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 06934daf03756fb7e094a4d622bb95d06660579f06e1c90dc21231673457d55c
MD5 51b74424ad6eecc5ec0478b8d6d2d619
BLAKE2b-256 e3e0f925b6eed9bb4529b2fcc998de14c0ca09c57dfe474b023d08d00af2adb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaflow_kubeflow-0.0.2-py3-none-any.whl:

Publisher: publish.yml on outerbounds/metaflow-kubeflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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