-
Does there exist an synchronous executor for tasks along these lines? class DummyFuture(Future):
def __init__(res=None, exc=None):
self.res = res
self.exc = exc
def result(self):
if self.exc:
raise self.exc
return self.res
def dummy_submit(func, *args, **kwargs):
try:
res = func(*args, **kwargs)
except Exception as e:
return DummyFuture(exc=e)
else:
return DummyFuture(res)
client = Client(synchronous=True) # effectively replaces Client.submit with dummy_submit above Haven't been able to find anything like this so far, but would be extremely helpful for debugging. The closest thing I have found is an example that requires using a tornado dummy executor, posted by @mrocklin in the SO answer below, however that solution requires quite a bit of overhead/boilerplate code. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It depends on what you are actually looking for. There is no single-threaded, synchronous distributed implementation. Distributed itself is by definition built of multiple entities and is managing how these work together (e.g. worker and scheduler). Recreating the logic performed by this complex system in a single-threaded machine would be, maybe counter-intuitively, not easy, many feature may even be impossible. At least a partial answer to why this is can be found in the SO comment https://stackoverflow.com/questions/44193979/how-do-i-run-a-dask-distributed-cluster-in-a-single-thread/44193980#comment91406782_44193980 If you are only relying on executing futures/tasks, there is a way in dask itself, see https://docs.dask.org/en/latest/scheduling.html#single-thread |
Beta Was this translation helpful? Give feedback.
It depends on what you are actually looking for.
There is no single-threaded, synchronous distributed implementation. Distributed itself is by definition built of multiple entities and is managing how these work together (e.g. worker and scheduler). Recreating the logic performed by this complex system in a single-threaded machine would be, maybe counter-intuitively, not easy, many feature may even be impossible. At least a partial answer to why this is can be found in the SO comment https://stackoverflow.com/questions/44193979/how-do-i-run-a-dask-distributed-cluster-in-a-single-thread/44193980#comment91406782_44193980
Imho, if you are relying on any distributed features, you should go fo…