https://prefect.io logo
l

Lukasz Mentel

01/21/2021, 7:25 PM
The main challenge is the task
compute_cop
which has two dependencies, and when I try to replicate that with
Flow.add_edge()
I can only specify a single
key
to pass the data between tasks. Does anyone know how to get solve or get around this?
a

alex

01/21/2021, 7:33 PM
I believe you can do
cop.set_upstream([task1, task2, ...])
to set dependencies. But if
result
and
power
are the dependencies you're referring to, prefect should automatically be able to identify them as dependencies since they are inputs to the
compute_cop
task. You can use
flow.visualize()
to see the dag and verify the dependencies.
l

Lukasz Mentel

01/21/2021, 7:49 PM
set_upstream
seems to be a good suggestion since it's a
Task
method but it also takes an optional
flow
parameter. I'll give it go, thanks!
z

Zanie

01/21/2021, 7:50 PM
The flow parameter is detected from the context if it’s not passed — so as long as you’re in the
with Flow ….
you don’t need to provide it.
l

Lukasz Mentel

01/21/2021, 7:55 PM
Sure, that works, but in this case I'm trying to specify the flow using the imperative API:
Copy code
flow = Flow(myflow)
flow.add_task(fetch_dataframe)
...
flow.set_dependencies()
can handle what I wanted to do 🙂