张强

    张强

    11 months ago
    Can I call
    subflows
    in the
    parent flow
    ?
    The code is running normally. But is this officially allowed to happen?
    from prefect import task, Flow
    
    @task
    def a():
        print('a!!')
    
    with Flow("children-flow") as children_flow:
        a()
    
    @task
    def b():
        for i in range(2):
            children_flow.run()
        print('bb!')
    
    with Flow("parent-flow") as parent_flow:
        b()
    
    parent_flow.run()
    Kevin Kho

    Kevin Kho

    11 months ago
    I guess for local testing you can but if you want to run with a backend, you should use the StartFlowRun task here .