islco / django-rq-wrapper

Django management command for multiple workers in one command and auto-reload of workers.
MIT License
14 stars 5 forks source link

autoreload flag doesn't work #7

Open hannonq opened 4 years ago

hannonq commented 4 years ago

Django-rq-wrapper shuts down workers immediately after starting when using the --autoreload flag. When only specifying the amount of workers, it works fine.

python manage.py rqworkers high default low --autoreload
2020-04-20 11:23:08 - INFO - Worker rq:worker:4d79f0bdd4ea4718975bf7a41372b872: started, version 1.3.0
2020-04-20 11:23:08 - INFO - *** Listening on high, default, low...
2020-04-20 11:23:08 - INFO - Warm shut down requested

My setup is:
Python 3.7.6
Django 3.0.3
django-rq 2.3.0
django-rq- wrapper 3.1
And ah, I'm running on MacOS 10.15.4

Any thoughts?

joesolly commented 4 years ago

I'm going to guess that we are not compatible with Django 3.x yet, without even looking at anything yet. Is it possible for you to check with something on the Django 2.x branch to see if that works still? I haven't used Django 3.x yet, but after a quick investigation, I think we are going to need a big rewrite for Django 3.x. For reference, the autoreload code is based off of the core django runserver. We will need to adapt to the new django.utils.autoreload.run_with_reloader(func, **kwargs). The new Django implementation seems to be way better than the old versions and should simplify our code, but we will likely need to completely separate the code or stop supporting Django 2.x. I would be in support of calling 3.1 our last version to support Django 2.x and dropping support and only supporting Django 3.x in future releases. We can always patch in fixes to the 3.x head if we really need a fix. Any thoughts @jcarbaugh ?

joesolly commented 4 years ago

Actually, I wasn't part of the Django 2.x upgrade either, so I was basing that off of 1.x. It looks like 2.x and 3.x are almost identical, so I'm not sure where the issue is. Any contributions are certainly welcome.

spetoolio commented 4 years ago

If it's any help I'm also seeing the same behavior in Django 2.2. Immediate shutdown after start. Maybe it's something to do with the transition to StatReloader by django??

(autoreload)INFO: Watching for file changes with StatReloader