Hi,
I played around with distributed to solve joblib/joblib#852, especially the ability of Client to switch from sync to async mode.
The documentation seems to state that it is possible:
|
If you want to reuse the same client in asynchronous and synchronous |
|
environments you can apply the ``asynchronous=True`` keyword at each method |
|
call. |
|
|
|
.. code-block:: python |
|
|
|
client = Client() # normal blocking client |
|
|
|
async def f(): |
|
futures = client.map(func, L) |
|
results = await client.gather(futures, asynchronous=True) |
|
return results |
But the following script just hangs forever without outputing anything.
from tornado.ioloop import IOLoop
from distributed import Client
async def f():
results = client.map(lambda x: x, [(1,), (2,)])
results = await client.gather(results, asynchronous=True)
return results
if __name__ == "__main__":
client = Client()
res = IOLoop.current().run_sync(f)
print("final result: {}".format(res))
When using Client(asynchronous=True) instead, the scripts runs fine.
Is it expected behavior?
Using python3.7, distributed master, tornado 6.0.3
Hi,
I played around with
distributedto solve joblib/joblib#852, especially the ability ofClientto switch from sync to async mode.The documentation seems to state that it is possible:
distributed/docs/source/asynchronous.rst
Lines 47 to 58 in e5ec8da
But the following script just hangs forever without outputing anything.
When using
Client(asynchronous=True)instead, the scripts runs fine.Is it expected behavior?
Using python3.7, distributed master, tornado 6.0.3