<#3644 [BUG] Subworkflow chaining does not work wh...
# flyte-github
a
#3644 [BUG] Subworkflow chaining does not work when run locally Issue created by d-tw Describe the bug When the order of two subworkflows is controlled via the chaining operator, the order of execution is not applied when the code is run locally (locally as in "via direct invocation of python", not locally as in "via a local cluster"). When the workflow is published to Flyte, the DAG and subsequent execution are correct. Expected behavior The order of execution of subworkflows should be identical between local runs and remote execution, especially in the case of unit testing. Additional context to reproduce The version of flytekit is 1.5.0. Sample code:
Copy code
from flytekit import workflow, task
import logging

logging.basicConfig(level="DEBUG")

logger = logging.getLogger("wf")
logger.setLevel("DEBUG")

@task
def task_1():
    <http://logger.info|logger.info>("task_1")

@task
def task_2():
    <http://logger.info|logger.info>("task_2")

@workflow
def sub_workflow_1():
    task_1()

@workflow
def sub_workflow_2():
    task_2()

@workflow
def parent_workflow():
    s1 = sub_workflow_1()
    s2 = sub_workflow_2()

    s2 >> s1

if __name__ == "__main__":
    parent_workflow()
Output is:
Copy code
INFO:wf:task_1
INFO:wf:task_2
Expected output is:
Copy code
INFO:wf:task_2
INFO:wf:task_1
Screenshots When registered with a Flyte cluster, the DAG is correct.

image

Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte