`dask.distributed.Lock` always async
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
**What happened**:
Using an asynchronous `dask.distributed.Client` both the asynchronous and synchronous context managers are asynchronous. Producing a `coroutine 'PooledRPCCall.__getattr__..send_recv_from_rpc' was never awaited` at runtime.
**What you expected to happen**:
I would intuitively always expect async functions to be asynchronous and regular functions synchronous.
**Minimal Complete Verifiable Example**:
```python
import asyncio
from dask.distributed import Client
from dask.distributed import Lock
async def lets_go(client):
print("requesting a")
async with Lock(name="a", client=client):
print("acquired a")
print("released a")
print("requesting b")
with Lock(name="b", client=client):
print("acquired b")
print("released b")
async def main():
async with Client(asynchronous=True) as client:
await lets_go(client)
if __name__ == "__main__":
asyncio.run(main())# Put your MCVE code here
```
**Anything else we need to know?**:
**Environment**:
- Dask version: 2022.5.0
- Python version: 3.9
- Operating System: macOS
- Install method (conda, pip, source): pipenv
Contributor guide
Assessment
This issue has not been assessed yet.