I'm trying to figure out how to run some Tasks in ...
# ask-community
e
I'm trying to figure out how to run some Tasks in parallel, like something like this in the second stage. There is no data passed between the stages, the tasks in the previous stage just have to complete with Success I know how to run them sequentailly like task_2(task_1()) but unclear if I should be using .map?
c
Hi Eric, how you build your flow is independent of how you execute your flow. In this case, whether your Flow can be executed in parallel is determined by your choice of executor. Check out this doc for more in-depth info on parallelism: https://docs.prefect.io/core/idioms/parallel.html
e
ah so it needs Dask then for this second stage parallelism
I missed this docs, so many rabbit holes to go down in the docs, didnt see this, thank you!
c
Yea no worries! Our docs have grown to a point where discoverability is a big challenge; itโ€™s something we plan to work on and improve soon!
๐Ÿ‘ 1
e
will the flow.visualize() automatically show the parallelism once dask is the execution engine?
c
Hm no, flow.visualize only shows your flows structure, not its runtime properties - if you use the Prefect UI you can best detect parallelism on the gantt chart view
๐Ÿ‘ 1
e
does 1 worker in DaskKubernetesEnvironment environment equal a single process, i.e. 1 task can be run concurrently?
seems like I have one dask pod in my kubernetes cluster and it had 2 concurrent tasks running
c
Not necessarily; each worker can be started with nthreads or nprocs flags (which have sensible defaults based on machine configuration) that give each individual worker parallelism capabilities
e
got it, that makes sense
i can override those here with this worker_spec.yaml ?
--nthreads ?
c
Yup exactly