Thread
#prefect-community
    Madison Schott

    Madison Schott

    1 year ago
    Hi all, I am trying to create a flow where one task depends on the completion of another task within the flow. However, no data is passed from one task to the next. Following the documentation, this is what I have so far. How do I pass the values I want to pass to the
    FiveTranSyncTask()?
    Also is it ok if I just have the
    dbt_task
    defined before this with the parameters needed?
    user_profile_w_campaign = Flow("User Profile with Campaign")
    user_profile_w_campaign.set_dependencies(
        task=dbt_task,
        upstream_tasks=[FivetranSyncTask()]
        )
    user_profile_w_campaign.run()
    Kevin Kho

    Kevin Kho

    1 year ago
    Try something like this:
    five_tran_task = FiveTranSyncTask(arg1, arg2)
    dbt_task = DbtShellTask(arg1, arg2)
    
    with Flow("User Profile with Campaign") as user_profile_flow:
        output1 = five_tran_task(input1, input2)
        output2 = dbt_task(input1, input2)
    
        output2.set_upstream(output1)
    
    user_profile_flow.run()
    You can also use this syntax, and pass the
    upstream_tasks
    as a kwarg
    with Flow("Trigger example") as flow:
        success = task_b(upstream_tasks=[task_a])
        fail = task_c(upstream_tasks=[task_a])
    Madison Schott

    Madison Schott

    1 year ago
    What would input1 and input2 be in that flow? If I already included the params as arg1 and arg2?
    Kevin Kho

    Kevin Kho

    1 year ago
    So tasks have an
    init
    and a
    run
    . The one above the flow block is the
    init
    . The one inside is the
    run
    . Imagine you have something like a task that outputs something you need for
    dbt_task
    or
    five_tran_task
    , you can pass it through the
    run
    method because it won’t be available during
    init
    . Other examples are connections stored as
    Secrets
    or
    Parameters
    . They can be passed during the
    run
    . It is fully possible that the
    init
    gives you everything you need and the
    run
    will just be
    output1 = dbt_task()
    . We are recommending to use the
    run
    more though because that’s when
    Parameters
    become available.
    Madison Schott

    Madison Schott

    1 year ago
    Ok that makes sense, I keep getting
    NameError: name 'FiveTranSyncTask' is not defined
    Kevin Kho

    Kevin Kho

    1 year ago
    Looks like I mistyped. First t is small there as seen here
    Madison Schott

    Madison Schott

    1 year ago
    Using that DbtShellTask() gives me this error
    TypeError: str expected, not NoneType
    Kevin Kho

    Kevin Kho

    1 year ago
    Is that for the run method?
    Madison Schott

    Madison Schott

    1 year ago
    yes
    Kevin Kho

    Kevin Kho

    1 year ago
    Can I see how you set it up?
    Madison Schott

    Madison Schott

    1 year ago
    nvm, looks like I got it working- thank you for all of your help!! :thank-you:
    Kevin Kho

    Kevin Kho

    1 year ago
    No problem!