# Scaling Out
With general availability of Prefect 2, we recommend new users start with Prefect 2.
Follow along in the Terminal
cd examples/tutorial python 06_parallel_execution.py
Let's adjust our
Flow to distribute its
Tasks onto a Dask Cluster, parallelizing its execution. This may sound involved, but will actually be our simplest adjustment yet:
from prefect.executors import DaskExecutor # ...task definitions... # ...flow definition... if __name__=="__main__": flow.run(executor=DaskExecutor())
This will spin up a Local Dask Cluster on your system to parallelize the tasks. If you already have a Dask Cluster deployed elsewhere, you can leverage that cluster by specifying the address in the
flow.run( executor=DaskExecutor( address='some-ip:port/to-your-dask-scheduler' ) )
Furthermore, you can implement your own
Executor for use with any Prefect
Flow, as long as the object provided satisfies the
Executor interface (i.e. appropriate
wait functions, similar to Python's
concurrent.futures.Executor interface). In this way, the sky is the limit!
What else can Prefect do?...