You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have seen the effort in #432, and the possibility for tasks to use get_client() to use dask themselves. However this is awkward as it requires the task-submitting-task to stay alive just to wait for results and pass them downstream.
Wouldn't it make sense for a task to be able to return Future or Delayed object to signify to dask that the result of those computations is the result of the task? Currently the Delayed object is simply passed through to the original caller.
Example weirdness (and this is in the simple case where each task only creates a single task):
deffibo(n):
ifn<=1:
return1delay=delayed(fibo)(n-1) +delayed(fibo)(n-2)
returndelayresult=client.compute(delayed(fibo)(5)).result()
whileisinstance(result, Delayed): # Got to keep executing until we get the actual resultresult=client.compute(result).result()
result
Apologies if this has been discussed in the past, I couldn't find this exact proposal anywhere. It is a pretty common pattern in asynchronous programming for deferred computations to return futures themselves, so I was surprise not to find it in dask.
Reacted by Jakub Beránek, Adam Klein and Sovetnikov
In general I agree that other mechanisms for task-spawning behavior could be developed to make complex workflows simpler. get_client was more-or-less the simplest way we could do this, so we did it first. Hopefully more use cases and attempts in this direction develop in the future.
Activity
mrocklin commentedon Sep 26, 2017
In general I agree that other mechanisms for task-spawning behavior could be developed to make complex workflows simpler.
get_clientwas more-or-less the simplest way we could do this, so we did it first. Hopefully more use cases and attempts in this direction develop in the future.