Skip to main content

SkyPilot extension for Metaflow

This extension adds support for executing steps in Metaflow flows on any cloud provider via SkyPilot.

Installation

pip install metaflow-skypilot

SkyPilot also requires cloud credentials to be configured. Follow the SkyPilot setup guide for your cloud provider.

Basic Usage

Add the @skypilot decorator to any step you want to run on the cloud:

from metaflow import FlowSpec, step, skypilot

class MyFlow(FlowSpec):

    @step
    def start(self):
        self.next(self.train)

    @skypilot(cpus='2+', memory='8+')
    @step
    def train(self):
        # This step runs on cloud via SkyPilot
        print("Training on the cloud!")
        self.next(self.end)

    @step
    def end(self):
        print("Done!")

if __name__ == '__main__':
    MyFlow()

Resource Configuration

The @skypilot decorator accepts all sky.Resources parameters directly, an example with a few of them is given below:

@skypilot(
    infra='aws',
    cpus='4+',
    memory='16+',
    accelerators='A100:1',
)
@step
def gpu_step(self):
    ...

Reusing a Named Cluster

By default, each run provisions a fresh ephemeral cluster that is torn down after the job finishes. To reuse a persistent cluster across runs, pass a cluster_name:

@skypilot(
    cpus='2+',
    cluster_name='my-persistent-cluster',
)
@step
def my_step(self):
    ...
  • Without cluster_name: a new cluster is provisioned, runs the job, and is terminated after 10 idle minutes.
  • With cluster_name: the cluster is reused across runs (auto-started if stopped). It stops automatically after 10 idle minutes but is not terminated — it will be restarted on the next run.

Each task always runs in an isolated working directory (~/metaflow/assets/<job_name>/) regardless of cluster type, so there are no filesystem clashes when reusing a cluster.

Using with @pypi

Use @pypi to install Python dependencies on the remote VM:

@skypilot(cpus='2+')
@pypi(python='3.9', packages={'numpy': '1.24.0', 'pandas': '2.0.0'})
@step
def my_step(self):
    import numpy as np
    ...

Supplying Credentials

Cloud credentials for accessing the Metaflow datastore (e.g. S3) can be supplied in three ways:

  • Instance IAM role / cloud identity: if the provisioned resource has access to the datastore via its cloud identity, no extra configuration is needed.
  • Environment variables via the @environment decorator:
@environment(vars={
    "AWS_ACCESS_KEY_ID": "XXXX",
    "AWS_SECRET_ACCESS_KEY": "YYYY"
})
@skypilot(cpus='2+')
@step
def my_step(self):
    ...
  • Secrets manager via the @secrets decorator.

If you are on the Outerbounds platform, authentication is handled automatically.

Things to Note

  • @skypilot cannot be combined with @kubernetes, @batch, or @slurm on the same step.
  • @parallel is not supported with @skypilot.
  • The minimum step timeout is 60 seconds.

Fin.

Metadata

Release files for metaflow-skypilot 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metaflow-skypilot 0.0.1
File Size Uploaded
metaflow_skypilot-0.0.1.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for metaflow-skypilot 0.0.1
File Interpreter ABI Platform
metaflow_skypilot-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / metaflow_skypilot-0.0.1.tar.gz

Download URL metaflow_skypilot-0.0.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e4443856ad00a538d7e0fe921c31935e9d3dae8772579145d4f0ec13cf7e72ac
BLAKE2b-256 checksum
How to use checksums
195175ed9f6eac001fae5abe1bf5876c52bc2df851a342f196e79914ecafc5bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.

Transparency log

Release files / metaflow_skypilot-0.0.1-py3-none-any.whl

Download URL metaflow_skypilot-0.0.1-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d1d33cb2da7e2d66286f0eb2e599bace475fd4e940ccadcd3621d990ad214f1
BLAKE2b-256 checksum
How to use checksums
d65ec84894fe53670be300aa08e7e64ea9f1df65d829313b8efe1e82b7bec2c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page