Prefect tasks for Slate — high-throughput multi-cloud data transfers
Project description
prefect-slate
Prefect tasks for Slate — move datasets and model weights between object stores from your Prefect flows at 984 MB/s, 4.4× faster than aws s3 cp.
Install
pip install prefect-slate
Setup
Make sure slate-api is running:
DATABASE_URL=sqlite:slate.db?mode=rwc slate-api
Usage
from prefect import flow
from prefect_slate import slate_transfer, SlateCredentials
creds = SlateCredentials(base_url="http://slate-api:3030")
@flow(name="ml-training-pipeline")
def ml_pipeline():
# Ingest raw dataset from S3 to GCS
ingest_result = slate_transfer(
src="s3://raw-data/datasets/imagenet/",
dst="gs://ml-staging/datasets/imagenet/",
slate_credentials=creds,
)
print(f"Ingested {ingest_result['bytes_transferred']} bytes")
# Copy model weights to GPU node (Prefect waits automatically via return value)
weights_result = slate_transfer(
src="gs://ml-staging/weights/llama-3-70b/",
dst="/mnt/nvme/weights/",
slate_credentials=creds,
priority=10,
max_attempts=5,
wait_for=[ingest_result],
)
print(f"Peak speed: {weights_result['peak_throughput_mbps']:.1f} MB/s")
if __name__ == "__main__":
ml_pipeline()
Server-side pipeline chaining
For transfers that should be chained inside Slate itself (not just Prefect task ordering), use depends_on_job:
@flow
def pipeline():
# Submit both jobs to Slate; Slate worker handles the dependency
ingest = slate_transfer(
src="s3://raw/",
dst="gs://stage/",
slate_credentials=creds,
)
# Slate won't start this until the ingest job_id completes
slate_transfer(
src="gs://stage/",
dst="gs://prod/",
slate_credentials=creds,
depends_on_job=ingest["job_id"],
)
Supported stores
| URL scheme | Provider |
|---|---|
s3://bucket/prefix |
AWS S3, MinIO, Cloudflare R2 |
gs://bucket/prefix |
Google Cloud Storage |
az://container/prefix |
Azure Blob Storage |
/path or file:///path |
Local filesystem |
Task reference
slate_transfer(
src="s3://...", # required
dst="gs://...", # required
slate_credentials=creds, # required
priority=0, # higher = picked up sooner
max_attempts=3, # retries with exponential backoff
depends_on_job=None, # Slate job ID (server-side chaining)
callback_url=None, # webhook on complete/fail
poll_interval=3.0, # seconds between status polls
timeout=None, # raise after N seconds
)
Returns a dict with job_id, bytes_transferred, peak_throughput_mbps, started_at, completed_at.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prefect_slate-0.2.0.tar.gz.
File metadata
- Download URL: prefect_slate-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d056ddc8bf387e5e36e3043bc33c1371f30da355914d5ff5f67bf9c9455c830e
|
|
| MD5 |
e0cd2609e81740fe438c669829683f2c
|
|
| BLAKE2b-256 |
62acd178f6b6d38ebde0c454d6b1ad49d1c4a68cf7b45746f8f6c7702d61f079
|
File details
Details for the file prefect_slate-0.2.0-py3-none-any.whl.
File metadata
- Download URL: prefect_slate-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9187c100863624337e6ee2234b83ea981b86a67a75049dabadc1c96f8c1a9978
|
|
| MD5 |
41f9e053bb24fcefd618ac866810c628
|
|
| BLAKE2b-256 |
4a7616970ac55cabb3be59a849f376ab5ade430a3b31d49443191f8108b5a013
|