Hi all, I am trying to create a flow where one tas...
# ask-community
m
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?
Copy code
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()
k
Try something like this:
Copy code
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
Copy code
with Flow("Trigger example") as flow:
    success = task_b(upstream_tasks=[task_a])
    fail = task_c(upstream_tasks=[task_a])
m
What would input1 and input2 be in that flow? If I already included the params as arg1 and arg2?
k
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.
m
Ok that makes sense, I keep getting
Copy code
NameError: name 'FiveTranSyncTask' is not defined
k
Looks like I mistyped. First t is small there as seen here
m
Using that DbtShellTask() gives me this error
Copy code
TypeError: str expected, not NoneType
k
Is that for the run method?
m
yes
k
Can I see how you set it up?
m
nvm, looks like I got it working- thank you for all of your help!! 🙏
👍 1
k
No problem!