samuelcolvin / arq

Fast job queuing and RPC in python with asyncio and redis.
https://arq-docs.helpmanual.io/
MIT License
1.98k stars 165 forks source link

TypeError: Redis.__init__() got an unexpected keyword argument 'retry_on_error' #456

Closed johnnybychance closed 2 weeks ago

johnnybychance commented 2 weeks ago

Hey, I am getting the following error when trying to run the demo worker:

TypeError: Redis.init() got an unexpected keyword argument 'retry_on_error'

I am still a python "rookie" so please forgive me if I am missing something obvious here, but i only installed arq & httpx, nothing else, and did so in a venv.

I used exactly the code from the docs so I have no idea what's going on.

JonasKs commented 2 weeks ago

Hi, welcome to the world of open source!
Always provide code examples so it's possible to reproduce. Hard to tell what's wrong without seeing any code.

johnnybychance commented 2 weeks ago

oh yeah, makes sense. It's just exactly the code from the docs 0.26 docs:

import asyncio
from httpx import AsyncClient
from arq import create_pool
from arq.connections import RedisSettings

# Here you can configure the Redis connection.
# The default is to connect to localhost:6379, no password.
REDIS_SETTINGS = RedisSettings()

async def download_content(ctx, url):
    session: AsyncClient = ctx['session']
    response = await session.get(url)
    print(f'{url}: {response.text:.80}...')
    return len(response.text)

async def startup(ctx):
    ctx['session'] = AsyncClient()

async def shutdown(ctx):
    await ctx['session'].aclose()

async def main():
    redis = await create_pool(REDIS_SETTINGS)
    for url in ('https://facebook.com', 'https://microsoft.com', 'https://github.com'):
        await redis.enqueue_job('download_content', url)

# WorkerSettings defines the settings to use when creating the work,
# It's used by the arq CLI.
# redis_settings might be omitted here if using the default settings
# For a list of all available settings, see https://arq-docs.helpmanual.io/#arq.worker.Worker
class WorkerSettings:
    functions = [download_content]
    on_startup = startup
    on_shutdown = shutdown
    redis_settings = REDIS_SETTINGS

if __name__ == '__main__':
    asyncio.run(main())

I ran

pip install arq httpx' then python demo.py' and arq demo.WorkerSettings --watch path/to/src

Then got [TypeError: Redis.__init__() got an unexpected keyword argument 'retry_on_error'](https://github.com/samuelcolvin/arq/issues/456#top)

johnnybychance commented 2 weeks ago

I ran this in a venv by the way so there shouldn't be any conflicting dependencies. I figured it might have to do with the redis version but arq installed 4.6 when i ran pip install arq

johnnybychance commented 2 weeks ago

oh nvm, it's working now even though I didn't change anything. That's odd

JonasKs commented 2 weeks ago

Hehe, glad it got resolved. 😊 Closing issue.