OWASP / OWASP/OpenCRE

Import Error from rq when trying to spin up a worker

Open
#582 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
180
Forks
137
Avg merge
3d 23h
Merged PRs (30d)
21

Description

It seems there is an issue when we try to spin up a worker. The following error occurs:

root@cb1fe159a166:/code# FLASK_APP=`pwd`/cre.py python cre.py --start_worker
Traceback (most recent call last):
  File "/code/cre.py", line 244, in <module>
    main()
  File "/code/cre.py", line 240, in main
    cre_main.run(args)
  File "/code/application/cmd/cre_main.py", line 631, in run
    from application.worker import start_worker
  File "/code/application/worker.py", line 3, in <module>
    from rq import Worker, Queue, Connection
ImportError: cannot import name 'Connection' from 'rq' (/usr/local/lib/python3.11/site-packages/rq/__init__.py)

We have validated that OpenCRE has a fully functioning Redis and OpenCRE is correctly configured to connect to it. We can after all see the jobs get queued in the respective redis keys.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with application/worker.py and the --start_worker path in application/cmd/cre_main.py, then reproduce the traceback using the command shown. Check the installed rq import behavior and verify that the worker starts without the ImportError while retaining the existing Redis job flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, redis
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.