faust-streaming / faust

Python Stream Processing. A Faust fork
https://faust-streaming.github.io/faust/
Other
1.66k stars 183 forks source link

Remove aredis #627

Open dakotahorstman opened 6 months ago

dakotahorstman commented 6 months ago

Checklist

Steps to reproduce

Configure App with a redis cache and a TypeError will be raised. This is due to https://github.com/python/cpython/issues/86558 where the loop parameter was removed from asyncio.open_connection in Python 3.10+. aredis was a port of redis-py for async functionality; however, redis-py now includes that functionality natively.

Additionally, aredis is unmaintained and has not been updated in years.

Expected behavior

No exception.

Actual behavior

TypeError was raised.

Full traceback

Traceback (most recent call last):
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 415, in connect
    await self._connect()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 594, in _connect
    reader, writer = await exec_with_timeout(
                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 39, in exec_with_timeout
    return await asyncio.wait_for(coroutine, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                         ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'loop'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/client.py", line 155, in execute_command
    await connection.send_command(*args)
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 486, in send_command
    await self.connect()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 417, in connect
    raise ConnectionError()
aredis.exceptions.ConnectionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 415, in connect
    await self._connect()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 594, in _connect
    reader, writer = await exec_with_timeout(
                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 39, in exec_with_timeout
    return await asyncio.wait_for(coroutine, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                         ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'loop'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/worker.py", line 277, in execute_from_commandline
    self.loop.run_until_complete(self._starting_fut)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 861, in _actually_start
    await child.maybe_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 889, in maybe_start
    await self.start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 861, in _actually_start
    await child.maybe_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 889, in maybe_start
    await self.start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 830, in start
    await self._default_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 837, in _default_start
    await self._actually_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/mode/services.py", line 854, in _actually_start
    await self.on_start()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/faust/web/cache/backends/redis.py", line 115, in on_start
    await self.connect()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/faust/web/cache/backends/redis.py", line 121, in connect
    await self.client.ping()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/commands/connection.py", line 20, in ping
    return await self.execute_command('PING')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/client.py", line 165, in execute_command
    await connection.send_command(*args)
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 486, in send_command
    await self.connect()
  File "/home/dev-user/.cache/pypoetry/virtualenvs/worker-9TtSrW0h-py3.12/lib/python3.12/site-packages/aredis/connection.py", line 417, in connect
    raise ConnectionError()
aredis.exceptions.ConnectionError

The aredis code causing the issue:

async def _connect(self):
    reader, writer = await exec_with_timeout(
        asyncio.open_connection(host=self.host,
                                port=self.port,
                                ssl=self.ssl_context,
                                loop=self.loop),  # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        self._connect_timeout,
        loop=self.loop
    )

Versions