OpenCRE icon indicating copy to clipboard operation
OpenCRE copied to clipboard

Import Error from rq when trying to spin up a worker

Open vfxcode opened this issue 11 months ago • 2 comments

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.

vfxcode avatar Feb 18 '25 11:02 vfxcode

hi @vfxcode Issue: Getting ImportError: cannot import name 'Connection' from 'rq' when trying to spin up the worker.

Steps Taken to Fix:

  1. Checked the installed rq version.
  2. Removed the deprecated Connection import.
  3. Used Redis for connection instead.
  4. Initialized the worker with the correct Redis connection.
  5. Tested and confirmed the worker is running successfully.

Next Steps:

Should we update the dependencies or document this change to prevent future issues? Let me know your thoughts!

Hardik301002 avatar Mar 12 '25 19:03 Hardik301002

Hey thank you for taking a look, yes please go ahead!

On Wed, 12 Mar 2025, 19:49 @., @.> wrote:

hi @vfxcode https://github.com/vfxcode Issue: Getting ImportError: cannot import name 'Connection' from 'rq' when trying to spin up the worker.

Steps Taken to Fix:

  1. Checked the installed rq version.
  2. Removed the deprecated Connection import.
  3. Used Redis for connection instead.
  4. Initialized the worker with the correct Redis connection.
  5. Tested and confirmed the worker is running successfully.

Next Steps:

Should we update the dependencies or document this change to prevent future issues? Let me know your thoughts!

— Reply to this email directly, view it on GitHub https://github.com/OWASP/OpenCRE/issues/582#issuecomment-2718936613, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMCRHSHOMN7U3UCPZUA6E32UCFVVAVCNFSM6AAAAABXLLV7AKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJYHEZTMNRRGM . You are receiving this because you are subscribed to this thread.Message ID: @.***> [image: Hardik301002]Hardik301002 left a comment (OWASP/OpenCRE#582) https://github.com/OWASP/OpenCRE/issues/582#issuecomment-2718936613

hi @vfxcode https://github.com/vfxcode Issue: Getting ImportError: cannot import name 'Connection' from 'rq' when trying to spin up the worker.

Steps Taken to Fix:

  1. Checked the installed rq version.
  2. Removed the deprecated Connection import.
  3. Used Redis for connection instead.
  4. Initialized the worker with the correct Redis connection.
  5. Tested and confirmed the worker is running successfully.

Next Steps:

Should we update the dependencies or document this change to prevent future issues? Let me know your thoughts!

— Reply to this email directly, view it on GitHub https://github.com/OWASP/OpenCRE/issues/582#issuecomment-2718936613, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMCRHSHOMN7U3UCPZUA6E32UCFVVAVCNFSM6AAAAABXLLV7AKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJYHEZTMNRRGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

northdpole avatar Mar 13 '25 22:03 northdpole