Skip to main content

Client library for running Prefect Cloud flows in Saturn Cloud

Project description

prefect-saturn

GitHub Actions PyPI Version

prefect-saturn is a Python package that makes it easy to run Prefect Cloud flows on a Dask cluster with Saturn Cloud. For a detailed tutorial, see "Fault-Tolerant Data Pipelines with Prefect Cloud ".

Installation

prefect-saturn is available on PyPi.

pip install prefect-saturn

prefect-saturn can be installed directly from GitHub

pip install git+https://github.com/saturncloud/prefect-saturn.git@main

Getting Started

prefect-saturn is intended for use inside a Saturn Cloud environment, such as a Jupyter notebook.

import prefect
from prefect import Flow, task
from prefect_saturn import PrefectCloudIntegration


@task
def hello_task():
    logger = prefect.context.get("logger")
    logger.info("hello prefect-saturn")


flow = Flow("sample-flow", tasks=[hello_task])

project_name = "sample-project"
integration = PrefectCloudIntegration(
    prefect_cloud_project_name=project_name
)
flow = integration.register_flow_with_saturn(flow)

flow.register(
    project_name=project_name,
    labels=["saturn-cloud"]
)

Customize Dask

You can customize the size and behavior of the Dask cluster used to run prefect flows. prefect_saturn.PrefectCloudIntegration.register_flow_with_saturn() accepts to arguments to accomplish this:

For example, the code below tells Saturn that this flow should run on a Dask cluster with 3 xlarge workers, and that prefect should shut down the cluster once the flow run has finished.

flow = integration.register_flow_with_saturn(
    flow=flow,
    dask_cluster_kwargs={
        "n_workers": 3,
        "worker_size": "xlarge",
        "autoclose": True
    }
)

flow.register(
    project_name=project_name,
    labels=["saturn-cloud"]
)

Contributing

See CONTRIBUTING.md for documentation on how to test and contribute to prefect-saturn.

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

prefect-saturn-0.5.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

prefect_saturn-0.5.1-py2-none-any.whl (10.4 kB view details)

Uploaded Python 2

File details

Details for the file prefect-saturn-0.5.1.tar.gz.

File metadata

  • Download URL: prefect-saturn-0.5.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for prefect-saturn-0.5.1.tar.gz
Algorithm Hash digest
SHA256 1072738cd7b77ac02171df4e449feebc43f45bf5d3394358c0208c76aee878c0
MD5 7e6350f78c2fcca7463f12d9e1328e08
BLAKE2b-256 09e44c151290c9fc13ae297a061d20dd179372cc42937be74518ac27d209c517

See more details on using hashes here.

File details

Details for the file prefect_saturn-0.5.1-py2-none-any.whl.

File metadata

  • Download URL: prefect_saturn-0.5.1-py2-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for prefect_saturn-0.5.1-py2-none-any.whl
Algorithm Hash digest
SHA256 ce029db3211a3ef84b0fde33e49ce9050c41a7bfbcbdb14fc3c50fc1f7795ee7
MD5 3369df75a62d4db2b55fecdbf2311746
BLAKE2b-256 50f9638357341e012415c32f6c81a1831213ed5d014621928678ba7d40ca5a90

See more details on using hashes here.

Supported by

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