rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)
MIT License
1.45k stars 229 forks source link

Added attribute for to job if not argument present #287

Open callluis opened 1 year ago

callluis commented 1 year ago

If we don't add the condition for the false then the scheduler breaks:

Traceback (most recent call last):  
File "/app/manage.py", line 10, in <module>    execute_from_command_line(sys.argv)  
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line    utility.execute()  
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute    self.fetch_command(subcommand).run_from_argv(self.argv)  
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 373, in run_from_argv    self.execute(*args, **cmd_options)  
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 417, in execute    output = self.handle(*args, **options)  
File "/usr/local/lib/python3.9/site-packages/django_rq/management/commands/rqscheduler.py", line 54, in handle    scheduler.run()  
File "/usr/local/lib/python3.9/site-packages/rq_scheduler/scheduler.py", line 479, in run    self.enqueue_jobs()  
File "/usr/local/lib/python3.9/site-packages/rq_scheduler/scheduler.py", line 450, in enqueue_jobs    self.enqueue_job(job)  
File "/usr/local/lib/python3.9/site-packages/rq_scheduler/scheduler.py", line 423, in enqueue_job    queue.enqueue_job(job, at_front=bool(job.enqueue_at_front))
AttributeError: 'Job' object has no attribute 'enqueue_at_front'
selwin commented 1 year ago

@callluis mind fixing the tests so I can merge this in?

callluis commented 1 year ago

Attempting to ...

callluis commented 1 year ago

I think I fixed the previous failing test, but now Im getting a lot of them cancelled and I don't know why. Also getting failed tests. Will try to fix those.

selwin commented 1 year ago

@callluis it may be related to the newly released RQ version. Please look at this comment https://github.com/rq/rq/issues/1893#issuecomment-1531602590