Tutorial Overview¶
Prefect orchestrates workflows — it simplifies the creation, scheduling, and monitoring of complex data pipelines. You define workflows as Python code and Prefect handles the rest.
Prefect also provides error handling, retry mechanisms, and a user-friendly dashboard for monitoring. It's the easiest way to transform any Python function into a unit of work that can be observed and orchestrated.
This tutorial provides a guided walk-through of Prefect's core concepts and instructions on how to use them.
You will:
- Create a flow
- Add tasks to it
- Deploy and run the flow locally
- Create a work pool and run the flow on remote infrastructure
These four topics will get most users to their first production deployment.
Advanced users that need more governance and control of their workflow infrastructure can go one step further by:
5.Using a worker-based deployment
If you're looking for examples of more advanced operations (such as deploying on Kubernetes), check out Prefect's guides.
Compared to the Quickstart, this tutorial is a more in-depth guide to Prefect's functionality. You will also see how to customize the Docker image where your flow runs and learn how to run flows on your own infrastructure.
Prerequisites¶
Before you start, make sure you have Python installed in a virtual environment. Then install Prefect:
pip install 'prefect<3'
See the install guide for more detailed instructions.
To get the most out of Prefect, you need to connect to a forever-free Prefect Cloud account.
- Create a new account or sign in at https://app.prefect.cloud/.
- Use the
prefect cloud login
CLI command to authenticate to Prefect Cloud from your environment.
prefect cloud login
Choose Log in with a web browser and click the Authorize button in the browser window that opens.
If you have any issues with browser-based authentication, see the Prefect Cloud docs to learn how to authenticate with a manually created API key.
As an alternative to using Prefect Cloud, you can self-host a Prefect server instance.
If you choose this option, run prefect server start
to start a local Prefect server instance.
First steps: Flows¶
Let's begin by learning how to create your first Prefect flow - click here to get started.