-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Job labels #530
Comments
Hey @andrewmarkle, thanks for writing this up! I didn't know about this GoodJob feature, it seems quite useful for cases like yours indeed. I imagine the ability to filter by labels is very important, no? It's not like you want to check the label when you get a failed job, so you don't actually need to filter by it, no? 🤔 I ask because I was wondering if this could be something that Active Job supports, instead of being something specific to the adapter... in that case, the obvious solution would be to store the labels with the Active Job serialized data, but filtering wouldn't be possible unless the adapter stored these in a specific way to allow for that. You'd get labels working out of the box with all adapters, though 🤔 |
Yes! Full-on adapter support vs. in-memory filtering is already at play in Mission Control for filtering jobs by class name. Solid Queue supports that "natively" (there's a column for that in the I think, to support this in Solid Queue, the labels would need to be part of the |
I'll look into this and give you some options! I forgot that we had to support all 3 types of databases but that makes sense. |
Hey @rosa. Thanks for this gem all the work you've done with SolidQueue. We're transitioning our monolith from Resque to SolidQueue and it's been a great experience!
Just wondering if you would be interested in a feature similar to GoodJob's labelled jobs.
The problem
For us we have a need for something like this feature so that we can add team labels to jobs. Our Rails app is worked on by hundreds of developers and we have a concept of codeownership where each class is owned and maintained by a team and this concept is codified in our app. What we would really love to do is be able to filter jobs by teams. This would allow teams to triage their own jobs and it would generally make our lives easier. But this solution would be flexible enough that anyone could add their own labels or job metadata and filter jobs by these labels in the UI.
Proposed solution
The basic premise is there would be an active job extension (very similar to how concurrency_controls are implemented) that you could include in your job and then you can add a label to a specific job.
This would then tie into Mission Control and we'd be able to filter jobs by these labels in the UI.
How Goodjob works is they store these labels in the database and essentially stamp jobs as they get enqueued with whatever labels are there at the time. This allows the UI to quickly filter and display these labels. For goodjob, because it's postgres, they store it as an array of text.
We could do something similar but I was kind of thinking of having a labels as it's own table? With unique label names. And then
SolidQueue::Job
would basically have the equivalent of ahas_many :labels
relationship and, when jobs are enqueued, we could essentially do alabel.find_or_create_by(name: active_job.label)
. In reality it would have to be more efficient than this so that we don't slow down job enqueuing but that's the general idea.Proposed table changes:
Anyway just throwing it out there. If this is something you would be interested in for solid_queue/mission control please let me know. I'd be happy to work on this feature and contribute back to both projects. Of course open to any feedback!
Thanks so much!
The text was updated successfully, but these errors were encountered: