rq icon indicating copy to clipboard operation
rq copied to clipboard

Schedule job for all workers

Open aparcar opened this issue 3 years ago • 3 comments

Hi, I'd like to schedule a cleanup job for all running workers, ideally periodically. Looking at rq-scheduler I can't find any way to make it worker specific. Is there such functionality? Is there a better approach?

aparcar avatar Jul 10 '22 16:07 aparcar

Hey, rq-scheduler is no longer being developed.rq-scheduler was my first attempt in creating scheduling features in RQ, but sometime ago I build scheduling functionalities into RQ here. The scheduler implementation in RQ is worker specific.

What kind of cleanup job are we talking about here? RQ workers themselves periodically run cleanup jobs so if there are junk that needs to be removed, it should be cleanup here.

selwin avatar Jul 24 '22 00:07 selwin

In my case the workers set up different SDKs and should frequently check when those SDKs were used the last time. In case they've been inactive for some time, it should remove those to save some storage space. Currently the action is performed after every build but a nicer approach would be tun run once a day or so.

Looking at the code I don't see a way to hook in my own cleanup functions.

aparcar avatar Jul 24 '22 10:07 aparcar

I think there are two possibilities:

  1. Custom callbacks for maintenance tasks
  2. Enhance scheduled jobs so that support repeats with custom intervals. rq-scheduler already supports this but I wasn’t too happy about the implementation, which is why I haven’t brought this functionality over.

Which one of the two approaches suits your use case more?

On Jul 24, 2022, at 5:58 PM, Paul Spooren @.***> wrote:

 In my case the workers set up different SDKs and should frequently check when those SDKs were used the last time. In case they've been inactive for some time, it should remove those to save some storage space. Currently the action is performed after every build but a nicer approach would be tun run once a day or so.

Looking at the code I don't see a way to hook in my own cleanup functions.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

selwin avatar Jul 24 '22 11:07 selwin