Koen
01/20/2025, 8:03 AMMarvin
01/20/2025, 8:03 AMpython
from prefect import flow
@flow
def first_subflow():
    # Your logic for the first subflow
    pass
@flow
def second_subflow():
    # Your logic for the second subflow
    pass
@flow
def main_flow():
    # Execute the first subflow
    first_result = first_subflow()
    
    # Use the result of the first subflow to trigger the second subflow
    if first_result is not None:
        second_subflow()
if __name__ == "__main__":
    main_flow()second_subflowfirst_subflowKoen
01/20/2025, 9:18 AMMarvin
01/20/2025, 9:18 AMupstream_tasksupstream_taskspython
from prefect import flow, task, get_run_logger
@task
def task_one():
    logger = get_run_logger()
    <http://logger.info|logger.info>("Running task one")
    return "result from task one"
@task
def task_two():
    logger = get_run_logger()
    <http://logger.info|logger.info>("Running task two")
@flow
def first_subflow():
    result = task_one()
    return result
@flow
def second_subflow(upstream_result):
    task_two(upstream_result)
@flow
def main_flow():
    # Run the first subflow and store its result
    first_result = first_subflow()
    
    # Pass the result of the first subflow to the second subflow
    second_subflow(first_result)
if __name__ == "__main__":
    main_flow()second_subflowfirst_subflowfirst_subflow