KG
07/29/2025, 5:01 PMMarvin
07/29/2025, 5:01 PMMarvin
07/29/2025, 5:02 PMpython
from prefect import flow, task
@task
def get_data():
return [1, 2, 3, 4, 5]
@task
def process_data(data):
return [x * 2 for x in data]
@flow
def my_first_flow():
data = get_data()
processed = process_data(data)
return processed
if __name__ == "__main__":
my_first_flow()
This simple flow demonstrates a few key Prefect concepts:
- @flow
decorator marks the main workflow
- @task
decorator marks individual units of work
- Automatic dependency tracking between tasks
- Built-in state management
Would you like me to dive deeper into any particular aspect? For example:
1. How to deploy flows to production
2. Setting up schedules and automation
3. Monitoring and observability features
4. Advanced flow patterns and best practices
Just let me know what interests you most, and I'll provide more specific information!