Skip to content

Instantly share code, notes, and snippets.

@southpolemonkey
Created December 4, 2019 04:38
Show Gist options
  • Save southpolemonkey/3228f902c5f66b44bd179ebda3be440b to your computer and use it in GitHub Desktop.
Save southpolemonkey/3228f902c5f66b44bd179ebda3be440b to your computer and use it in GitHub Desktop.
async-await example
import asyncio
from dask.distributed import Client
def inc(x: int) -> int:
return x + 1
async def f():
async with Client(asynchronous=True) as client:
future = client.submit(inc, 10)
result = await future
print(result)
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(f())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment