-
Notifications
You must be signed in to change notification settings - Fork 335
RuntimeError: Task <Task pending name='Task-11' coro=...> got Future <Future pending> attached to a different loop #1273
Comments
I agree; moving to get_running_loop was in the plan as Python 3.6 is EOL. Thanks for notifying. |
Ok great! When do you think this will be released? |
I am in the process of migrating aioredis to redis-py by RedisLabs or maker of Redis. Because I'm stupid and enrolled in too many classes, I'd expect the asyncio module of redis-py to rollout late February. Really sorry! I decided on this due to the maintainership history of the repo, so again I really apologize for the delay! |
That's ok, don't beat yourself up, I was just curious to have an ETA. Why are you migrating to redis-py? Does RedisLab have a better Python integration? |
redis py combines the sync and async together like elastic search py. There are plenty of maintainers there unlike here which has a poor track record of maintainership (which includes my inactivity), and they will support way more features than I could like Redis module and cluster at fast pace. Thanks for understanding :) |
Thank you for the clarification, there is one last thing that I wonder, if you could help: Should we switch to RedisLabs's Python integration of Redis, even for async calls? (if so, could you share me the link to the repository please) Thank you :) |
When the asyncio module is merged, yes. You can find the client here: https://github.com/redis/redis-py As of now, continue developing with aioredis as we have not yet merged anything yet. When you migrate to redis-py, you only have to switch the import statements to say redis. The code is an exact replica. |
That's awesome! So you work with Redis to integrate aioredis within py-redis, by providing a similar interface, is that correct? |
Correct (tho i'm just a student, not an employee 😅) |
That works for me, thank you for your clarification and your time :) |
(If there is a place I can track to follow the migration, can you please share it?) |
Yes, redis/redis-py#1899 I'm currently bidding my time for my midterms to end next week to finally get started on cluster and modules support (it's just copying more code). If you'd like to help the team, please make a PR in my fork! |
Unfortunately I can't, I don't have time neither, even though I'd love to work on these kind of things. Good luck with your midterms! |
Hi! @cnicodeme, did you solve the problem? I have tried to |
No, I'm waiting on the migration to Redis-py to be completed and then it should be good :) |
is there any workaround atm? |
I'm waiting for the go ahead to drop Python 3.6 support for redis py to implement the correct API. Otherwise, I think the only way to fix it is by monkey patching asyncio in all aioredis files |
Having stumbled upon this exact same issue in my code, I'm wondering if you guys may have already resolved it in some way and documented somewhere? Has the migration to redis-py happened already and if so, what's the migration path for downstream use of aioredis? |
Describe the bug
Hi!
I'm running aioredis via a Celery task. Since Celery is not async by default, I'm creating a custom loop when inside the Celery task, and running an async function from that new loop.
The issue is that aioredis seems to try and access the "registered" loop by calling
get_event_loop
at various places.Based on the documentation](https://docs.python.org/3/library/asyncio-eventloop.html) it would be better to replace all the calls to
get_event_loop
toget_running_loop
which would remove that Runtime exception when a future is attached to a different loop.For instance, this specific error occurs on asyncio/streams.py in wait_closed at line 344
To Reproduce
Calling
loop.run_until_complete(redis_get())
will generate an error :Replacing the above line by
Causes no errors at all (using the default loop)
Expected behavior
Getting the loop on various parts of Aioredis should not expect to have only one loop running, and shouldn't expect it to be the default one
Logs/tracebacks
Python Version
aioredis Version
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: