Problem
I tried to use the redis to schedule a job to run at a later time, the jobs just sat in the that state.
RQ 2.x stores jobs created with Queue.enqueue_in() in each queue's scheduled registry. They are only moved to the real Redis queue when a worker runs with RQ's embedded scheduler (Worker.work(with_scheduler=True)).
flexmeasures jobs run-worker currently calls worker.work() without with_scheduler, so scheduled jobs never run while jobs enqueued immediately work fine.
Proposed fix
- Call
worker.work(with_scheduler=...) with default enabled.
- Allow disabling via
--no-with-scheduler / --with-scheduler and env FLEXMEASURES_RQ_WITH_SCHEDULER (0/false/no to disable).
Context
Plugins or integrations using enqueue_in for delayed background work see jobs pile up under "Scheduled jobs" in flexmeasures jobs show-queues while workers sit idle on the queue.
Should it have a yml setting so you can turn this on/off with default on or should it just be on by default?
A PR will be proposed, once we decide if we want yml flag or not.
Problem
I tried to use the redis to schedule a job to run at a later time, the jobs just sat in the that state.
RQ 2.x stores jobs created with
Queue.enqueue_in()in each queue's scheduled registry. They are only moved to the real Redis queue when a worker runs with RQ's embedded scheduler (Worker.work(with_scheduler=True)).flexmeasures jobs run-workercurrently callsworker.work()withoutwith_scheduler, so scheduled jobs never run while jobs enqueued immediately work fine.Proposed fix
worker.work(with_scheduler=...)with default enabled.--no-with-scheduler/--with-schedulerand envFLEXMEASURES_RQ_WITH_SCHEDULER(0/false/no to disable).Context
Plugins or integrations using
enqueue_infor delayed background work see jobs pile up under "Scheduled jobs" inflexmeasures jobs show-queueswhile workers sit idle on the queue.Should it have a yml setting so you can turn this on/off with default on or should it just be on by default?
A PR will be proposed, once we decide if we want yml flag or not.