Skip to content

Enable RQ embedded scheduler in flexmeasures jobs run-worker (enqueue_in jobs stuck) #2105

@Ragnar-the-mighty

Description

@Ragnar-the-mighty

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions