Hi 👋
I am struggling to make my prefect depth-first and not breadth-first.
My flow is set up like so:
Copy code
from prefect.executors import LocalDaskExecutor
from prefect import Flow
with Flow(name=name, executor=LocalDaskExecutor(scheduler="threads", num_workers=1)) as flow:
...
Do I need to use another executer or where can I learn more about this?
k
Kevin Kho
08/12/2021, 2:07 PM
Hey @Newskooler, this has to do with Dask preferring depth first execution, but it can’t be forced also and the scheduler will decide to do things in a breadth first way.
n
Newskooler
08/12/2021, 2:41 PM
I remember before it used to always do depth first - can I make Prefect run in depth first in some way?
k
Kevin Kho
08/12/2021, 2:45 PM
The only idea I have is try using
DaskExecutor()
instead of
LocalDaskExecutor()
, even if this is on Local. I thinkt he DaskExecutor tends more to be depth first from experience. You might get into issues with warnings about
freeze_support()
so you may have to do:
Copy code
if __name__ == "__main__":
flow.run()
If doing a local run.
n
Newskooler
08/12/2021, 2:52 PM
So I don’t understand on what basis does it make a choice and why is that not a user choice?
k
Kevin Kho
08/12/2021, 3:08 PM
So this is mainly a Dask question and how they choose which task to go next. It’s not something that’s in their docs, but it’s complex and based on heuristics for task size etc. It’s also not something you can predict a priori because it also matters. I know this answer may be unsatisfying to you, so I’ll go hunt down a better answer from people who know more and get back to you.
n
Newskooler
08/12/2021, 3:20 PM
Okay - thanks a lot. I remember a few version back my code worked depth-first always and then smth changed.
k
Kevin Kho
08/12/2021, 3:26 PM
That may be the Dask version and changes to their scheduler.
👍 1
n
Newskooler
08/12/2021, 3:35 PM
Cool thanks. Let me know if you find a way to do this :)
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.