Scott
01/08/2025, 5:20 PMMarvin
01/08/2025, 5:20 PM.serve method in Prefect 3.x. The serve method is a long-running process that allows you to execute remotely triggered or scheduled runs, and you can serve multiple flows using this utility.
Here's an example of how you might define and serve a flow with parameters:
python
from prefect import flow, serve
@flow
def my_flow(param1: int, param2: str):
print(f"Running with param1: {param1} and param2: {param2}")
if __name__ == "__main__":
# Serve the flow, which allows it to accept parameters when triggered
serve(my_flow)
When you trigger this flow through the Prefect UI or API, you can specify the parameters param1 and param2 to customize the execution.
For more details, you can refer to the Prefect documentation on running flows in local processes.Nate
01/08/2025, 5:21 PMparameters: dict on serveScott
01/08/2025, 5:22 PM