python-arq / arq

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

Unable to run `redis.queued_jobs()`. Job not found error. #466

Open samuel-108 opened 4 months ago

samuel-108 commented 4 months ago

The redis.queued_jobs() query is showing the job not found error.

2024-06-23T04:27:49.223303340Z ERROR:root:Error occurred: job "arq:job:23aaa17974cb44b6997e5894336c9bc7" not found 2024-06-23T04:27:49.223343548Z Traceback (most recent call last): 2024-06-23T04:27:49.223356845Z File "/app/src/api/task_admin.py", line 137, in requeue_token_tasks 2024-06-23T04:27:49.223362776Z all_jobs = await redis.queued_jobs() 2024-06-23T04:27:49.223368103Z File "/usr/local/lib/python3.10/site-packages/arq/connections.py", line 217, in queued_jobs 2024-06-23T04:27:49.223373875Z return await asyncio.gather(*[self._get_job_def(job_id, int(score)) for job_id, score in jobs]) 2024-06-23T04:27:49.223379384Z File "/usr/local/lib/python3.10/site-packages/arq/connections.py", line 204, in _get_job_def 2024-06-23T04:27:49.223385012Z raise RuntimeError(f'job "{key}" not found') 2024-06-23T04:27:49.223390934Z RuntimeError: job "arq:job:23aaa17974cb44b6997e5894336c9bc7" not found

jianyuan commented 1 month ago

I believe this happens when we list a job and one or more jobs expire as soon as we list all the keys.