This library allows for the easy construction and management of Dask clusters.
Project description
Distributed Runner
This library allows for the easy construction and management of Dask clusters via a simple context manager.
Installation
pip install distrunner
Usage
In your scheduler (Airfow etc.) use something like this:
from distrunner import DistRunner
import whatismyip
def main():
with DistRunner(workers=10) as cldr:
results = cldr.client.map(print_ip, range(10))
outcome = cldr.client.gather(results)
print(outcome)
def print_ip(x):
return f"My IP address is {whatismyip.whatismyip()}"
The "local" flag will determine whether a remote cluster is created. For example, the following will all run locally instead of spinning up infrastructure:
from distrunner import DistRunner
import whatismyip
def main():
with DistRunner(workers=10, local=True) as cldr:
results = cldr.client.map(print_ip, range(10))
outcome = cldr.client.gather(results)
print(outcome)
def print_ip(x):
return f"My IP address is {whatismyip.whatismyip()}"
You will need to set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to use the Fargate clusters (or run from an environment with an authorised IAM role).
Features
- Context manager handling of Dask Fargate clusters with scale-to-zero on complete
- Easy ability to switch between local and distributed/remote development
What it Does
This library allows you to easily run functions across a Dask cluster.
Credits
Copyright © Crossref 2023
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
Hashes for distrunner-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b91ee7f0ae95100e055dc00dcaa4b0fa9cc38567f7065088b0c71c66a671d03 |
|
MD5 | dc2904b749ca5bbd5af8ed0181709686 |
|
BLAKE2b-256 | b1f3c93f3e368523b2cce30e5c62be19d3ad672d8bbd2ecc4e31341db77ef001 |