Why are our flow limited to a concurrency of 2 tas...
# ask-community
h
Why are our flow limited to a concurrency of 2 tasks? We are using prefect cloud with a Kubernetes Agent running 2 workers. For some reason it only runs 2 tasks concurrently. I have tried setting the executor to DaskExecutor() and LocalDaskExecutor(). The behaviour stays the same The tasks I am running in this example are just waiting for 10 seconds, so resource constraints can’t really be the issue. I assume it’s limiting it to 1 concurrent task per Kubernetes worker node, but haven’t been able to confirm that. Anyone know any possible reasons for this?
1
k
Hey @Hilary Roberts, could I see how you set up the executor and run configuration?
h
Sure, what do you need to see exactly? I defined the flow like this:
Copy code
with Flow(
        "name",
        schedule,
        run_config=KubernetesRun(),
        executor=DaskExecutor()
) as flow:
   ...
And also with the LocalDaskExecutor
k
Did you try bumping up the number of workers like:
Copy code
flow.executor = LocalDaskExecutor(scheduler="threads", num_workers=8)
h
I'll give that a go
k
Or
Copy code
flow.executor = DaskExecutor(
    cluster_kwargs={"n_workers": 4, "threads_per_worker": 2}
)
h
Nice! The Local one worked, thanks! I'll try the second option too.
👍 1
What exactly is the difference between the Local and normal Dask executor? Is it better to use the normal one usually?
k
The
LocalDaskExecutor
does not use
distributed
and is a Local Dask multiprocessing pool while the
DaskExecutor
works on
distributed
so you would use it if you had multiple machines (a cluster), which I think you do in your setup.
h
Got it, so I guess the local just runs it on the master node.
k
Yep!