Create your first workflow
Create and login to your Prefect Cloud account.
prefect-cloud
. We’ll leverage uv
, a modern Python package manager, to do this. Run the following commands in your terminal, after which you’ll be prompted in your browser to create or login to your free Prefect Cloud account.What code should run?
@flow
decorator on the script’s entrypoint.@task
decorator on each function called within the flow.flow
, Prefect dynamically creates a graph of each task
and the state of their upstream dependencies. This allows Prefect to execute each task
in the right order and, in the case of failure, to recover the state of your workflow and resume from its point of failure.Let’s run this code locally on your computer. To do that, run the following command in your terminal.Where should it run?
flow
locally. Let’s get it running off of your machine! Again, for simplicity,
we’ll deploy this workflow to Prefect’s Serverless Compute (so we don’t have to wrangle any infrastructure). We’ll tell Prefect to clone
https://github.com/PrefectHQ/quickstart
and invoke 01_getting_started.py:main
.When should it run?
prefect-cloud schedule
command.Let’s schedule our workflow to run every day at 8:00 AM with cron
syntax.