Anyone else had the problem of mapped tasks succee...
# ask-community
m
Anyone else had the problem of mapped tasks succeeding with every sub-task but staying in a
mapped
state?
n
Hi @matta - that’s expected behavior, since Mapped is a specialized inheritor of the Success state
upvote 1
m
@nicholas Ah, nice! So, I'm having a larger problem of flows not terminating after everything succeeds. I thought that might have been it.
But they'll run for hours unless I manually change the state.
c
I’ve seen that before - are you running on dask?
m
Yup!
c
Ah so at the end of the run, the flow runner process gathers all task states (including results!), and sometimes that can either hang the dask scheduler or the process runs out of memory. If you could check the memory / CPU of that process and provide more that could resolve it. Longer term we would like to improve performance around things like this but we don’t have a concrete plan for it yet
m
@Chris White Does it make a difference if I'm using threads?
m
oh whoops I forgot my phone and computer were different accounts lol
would changing any args here make a difference?
Copy code
executor = DaskExecutor(
    cluster_kwargs={"processes": False}, adapt_kwargs={"maximum": 6},
)
c
Hm no if you aren’t using an external cluster then I’m not sure that my story makes sense 🧐
Although give it a shot - I’d be interested to hear if it helps because that would give us a place to look deeper
m
Maybe putting a memory limit back might help?
I forget what the arg for that is
And not sure where to find it actually.
The containers are limited to 4GB
maximum_memory
there we go
It's pretty unpredictable too btw - sometimes it works and sometimes it doesn't and there's no real rhyme or reason.
Wish I could understand why it works sometimes and not others!
Is there anything to look for in the logs, maybe?
c
No but you might install an editable install of prefect and add some breakpoints or logs in the flow runner to see where it freezes; alternatively there are some interesting Python packages that let you analyze another Python process but I’m very rusty on the details there
I’m guessing it’s freezing on the final gather of task states
In which case maybe the dask UI would be helpful to look for clues
m
@Chris White Is there a guide on using the Dask UI while using Prefect on a remote server? Or do you mean like using the Dask UI in Jupyter?
Incidentally, adding a memory limit definitely made things worse instead of better =D
c
Interesting - and no guide for that, while the flow is running you should be able to port forward to the server on whatever port the dashboard is exposed on
m
@Chris White Is there a way to do that if I don't have SSH access to the Prefect server?
c
Hmmm that’s very dependent on the server and network config so hard for me to say - I’d look up port forwarding for whatever service you’re using
m
Sorry, what's "service" mean in this context? It's running on a Kubernetes cluster in AWS, are either of those things relevant?
It's Prefect Core btw, if that makes a difference.
c
Yea, look at port forwarding to a pod in AWS kubernetes and you’ll just need to look up the dask dashboard default port number
e
I've seen this too. Be interested to hear what you find matta
m
Got an update here! Switched from threads to processes, and now it works fine. so, went from:
Copy code
executor = DaskExecutor(
    cluster_kwargs={"processes": False}, 
    adapt_kwargs={"maximum": 6,},
)
to
Copy code
executor = DaskExecutor(
    adapt_kwargs={"maximum": 6,},
)
🧐 1
Not totally sure why that fixed it, but it did! 🤷‍♂️
c
I’m going to archive this thread for others to find — @Marvin archive “Mapped flow does not complete - switching to using processes resolves the issue”
👍 1