Created
December 4, 2019 04:38
-
-
Save southpolemonkey/3228f902c5f66b44bd179ebda3be440b to your computer and use it in GitHub Desktop.
async-await example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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