Slackbot
01/10/2025, 2:17 AMMarvin
01/10/2025, 2:17 AMrun_deployment
method to execute the nested flow conditionally. This approach is recommended if you need to manage the flow runs independently.
Here's a basic example to illustrate these steps:
python
from prefect import flow, task
from prefect.deployments import run_deployment
@task
def condition_check():
# Replace this with actual logic
return True
@flow
def nested_flow():
print("Running nested flow")
@flow
def parent_flow():
if condition_check():
run_deployment("nested-flow-deployment-name")
if __name__ == "__main__":
parent_flow()
- Observability: Nested flows have first-class observability within the Prefect UI and Prefect Cloud, allowing you to monitor their status independently.
- Parameters: You can pass parameters to the nested flow for different use cases.
For more detailed information, you can refer to the Prefect documentation on writing flows.