-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Immediate async tasks are not awaited #5929
Comments
How so, am I missing something it looks like they are: pulpcore/pulpcore/tasking/tasks.py Lines 69 to 72 in 21f2c21
|
Hmm, if you see the line above, the actual task code ( Also, do you know any task defined as an async coroutine? I feel like Mathias once said that there were none, really. pulpcore/pulpcore/tasking/tasks.py Lines 68 to 72 in 21f2c21
|
>>> import asyncio
>>> async def hello():
... print("hello")
...
>>> a = hello()
>>> asyncio.iscoroutine(a)
True
>>> loop = asyncio.get_event_loop()
<python-input-4>:1: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
>>> loop = asyncio.new_event_loop()
>>> loop.run_until_complete(a)
hello With my current understanding of asyncio I think we have valid handling code, the async code won't run till put into an event loop. Our only potential problem is that I don't know what the status of the current event loop is in the api worker, so we might be calling deprecated code (deprecated in python 3.12 to call get_event_loop without a running loop). |
Oh, I see, thanks for clarifying! Asyncio is not in my heart yet 😅 |
First, yes, we don't have any async tasks yet. But also I cannot see what tipped me off back then. Maybe it got fixed in the meantime... I'm OK with closing this one. |
Tasks defined as async coroutines are not properly handled when run immediate by the api worker.
The text was updated successfully, but these errors were encountered: