fsspec / fsspec/filesystem_spec
Asyncio.get_event_loop does not work with fsspec.asyn.sync
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 490
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 38
Description
Hello, the example below does not work, while I believe it should work.
import asyncio
import fsspec.asyn
print("yey")
loop = asyncio.get_event_loop()
fsspec.asyn.sync(loop, asyncio.sleep, delay=5)
print("yey")
After printing out the first "yey" the program does not output anything, and when it is stopped, it outputs this:
yey
Traceback (most recent call last):
File "F:\SecondaryDownloads\git_repos\gradio\dev_mode.py", line 7, in <module>
print("yey")
File "F:\SecondaryDownloads\git_repos\gradio\venv\lib\site-packages\fsspec\asyn.py", line 54, in sync
if event.wait(1):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line 574, in wait
signaled = self._cond.wait(timeout)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\threading.py", line 316, in wait
gotit = waiter.acquire(True, timeout)
KeyboardInterrupt
However, it works perfectly when fsspec.asyn.get_loop is used.
import asyncio
import fsspec.asyn
print("yey")
loop = fsspec.asyn.get_loop()
fsspec.asyn.sync(loop, asyncio.sleep, delay=5)
print("yey")
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the fsspec.asyn.sync and fsspec.asyn.get_loop entry points shown in the examples. Reproduce the asyncio.get_event_loop case and compare it with the get_loop case, including the reported wait in threading.Event.wait. Done means the first example completes and prints both messages without interruption.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100