django-commons / django-tasks-scheduler

Schedule async tasks using redis protocol. Redis/ValKey/Dragonfly or any broker using the redis protocol can be used.
https://django-tasks-scheduler.readthedocs.io/
MIT License
58 stars 11 forks source link

Add Custom job class (--job-class) to rqworker #159

Closed gabriels1234 closed 2 months ago

gabriels1234 commented 2 months ago

Hi @cunla , I'm dealing with porting a django_rq-based project to django-tasks-scheduler. This one, has the particular need of a custom job class.

Describe the solution you'd like Similar to #155, we could add the functionality to match what RQ's is offering

Describe alternatives you've considered I found no other alternative to get same functionality I had was to re-introduce the --job-class arg to rqworker

cunla commented 2 months ago

what does the custom job class do? I am not against it, but in order to avoid complexity, I think some constraints should be added.

gabriels1234 commented 2 months ago

@cunla I'm forced to use a custom class because of the way the job is received from Redis. It's a feature from RQ that otherwise would prevent me from switching to django-tasks-scheduler. The change I made is minimally invasive, as simple as it can get. Would be just one if to the Worker init method. I've added a test to test functionality. Maybe I need to add one more test to ensure I'm covering all the options (creation without sending the --job-class arg). Please LMK what you think. Thanks so much!!!!