felixmosh / bull-board

🎯 Queue background jobs inspector
MIT License
2.34k stars 366 forks source link

Support managing jobSchedulers in bull-board. #827

Open lpoulin opened 1 month ago

lpoulin commented 1 month ago

As of bullmq@5.16.0, jobSchedulers are the recommended way to manage scheduled jobs that run on an interval. It would be awesome if these could be managed (added, removed, changed) via the dashboard.

lpoulin commented 1 month ago

I would be happy to work on this btw, sounds fun!

felixmosh commented 1 month ago

Go for it :)

lpoulin commented 1 month ago

@felixmosh what are your thoughts about where to have it in the UI? Originally I was thinking to have 'Scheduled' as another status but it's not really a job 'status', so I was thinking about making it a modal that could be opened from the dropdown below 'add job'. My only hesitation there is that it is kind of hidden.

felixmosh commented 1 month ago

Can u explain what is new with the new approach?

lpoulin commented 1 month ago

Check out the docs of job schedulers here. Basically, you can add something called a job scheduler to a queue that contains a pattern/interval for putting new jobs on the queue. You can also add job templates with a scheduler that will ensure that all jobs produced by that scheduler inherit the settings.

My idea is that we can have a way to display the job schedulers that exist for the selected queue. From there, we could edit/delete them. It would also be nice to be able to add job schedulers from the UI.

A job scheduler is a thing that produces jobs, not a job itself. But, like jobs, they are something that are added and exist on a queue.

Now I'm thinking it may make sense to display a button in the header actions (iff a queue is selected) to open the scheduler management modal, or perhaps it could even be its own page image

felixmosh commented 1 month ago

Ha, cool feature, it should go under queue actions (the place where we have Add Job) I think that it should apear as a new modal, with that upsertScheduler props.

Pay attension to the fact that this should be added only on bullmq queues (we have a flag for that)

A place to manage jobSchedulers should be in a new Page, which will allow to list them & remove

lpoulin commented 1 month ago

Makes sense, thanks for the feedback. So add 'Add Job Scheduler' under queue actions for adding them, and a new page for listing/managing. How should the user navigate to said page?

felixmosh commented 1 month ago

Maybe we should add a link at the right of queue statuses (before 3 dots of queue actions)?

lpoulin commented 1 month ago

There isn't a whole lot of room up there (at my current resolution the statuses go all the way to the queue actions) and if we have to start scrolling it would be hidden. I'm going to add it as a queue action for now and we can iterate. image

lpoulin commented 1 month ago

Also, could you please point out where the library flag is in the UI so it can be displayed conditionally? Not having luck finding it @felixmosh

felixmosh commented 1 month ago

Here, https://github.com/felixmosh/bull-board/blob/04131152497b07289dbdd799700f825b06a67e08/packages/api/src/handlers/queues.ts#L92