delayed does not work with local_client
See original GitHub issueUsing delayed to launch tasks from workers does not always work. As reproducible example, I have modified the fibonacci example to use delayed (fib_2 function) instead of submit/gather (fib function).:
from distributed import Client, local_client
def fib(n):
# this is using the submit idiom, which is working
if n < 2:
return n
else:
with local_client() as lc:
a = lc.submit(fib, n - 1)
b = lc.submit(fib, n - 2)
a, b = lc.gather([a, b])
return a + b
def add(a, b):
return a + b
def fib_2(n):
# this is using delayed, which is not working
from dask import delayed
if n < 2:
return n
else:
with local_client() as lc:
a = delayed(fib_2)(n - 1)
b = delayed(fib_2)(n - 2)
s = delayed(add)(a, b)
r = s.compute()
return r
def fib_delayed():
# get a delayed fib calculation, to make sure the local_client is only spawned from a worker
from dask import delayed
d = delayed(fib_2)(10)
return d
if __name__ == '__main__':
c = Client()
fib_d = fib_delayed()
print(fib_d.dask) # should only have 1 key, the rest is submitted from the worker
print(fib_d.compute())
running this gives me lots of “Compute failed” errors and a an endless traceback which I’ll omit here.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
RDS Gateway 60 second delay - TechNet - Microsoft
The client is not happy with the 60 second delay though (understandably), and has asked me to to solve the problem.
Read more >Bullet spawn (visually) delayed on client - Unity Forum
Spawning locally caused other issues, then other players see delayed bullet position for that client.. maybe because player position if not ...
Read more >Delay in High Performance scenario · Issue #1478 - GitHub
Our scenario is working fine, but message are arriving with an increasing delay of several minutes to the MQTT broker.
Read more >Netty: how do I reduce delay between consecutive messages ...
When using a local client the two messages arrive at the same time. If the remote client sends another request before the second...
Read more >Main Monitor responding delayed when conencting to virtual ...
Now to get to the problem: I'm connecting to the Virtual Desktops over Citrix Storefront which is located in our Intranet of course....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So this does work when I replace “s.compute()” with “lc.compute(s); r=s.result()”. I always assumed delayed.compute() to be a shortcut of “f=client.compute(d); f.result()” but apparently that is not true within the context of local_client(). Thus I think we can narrow this down to “delayed.compute()” does not work with local_client".
It looks like things have changed since this issue was opened, I don’t get this problem happening today.
When I run the example with a more recent version of dask/distributed (2021.09.0) I don’t see any errors. (It does tell me that
local_client
has been moved/renamed toworker_client
, but that’s not a problem).