-
Notifications
You must be signed in to change notification settings - Fork 18
Job improvements #1054
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 improvements #1054
Conversation
914c837 to
a5d3abb
Compare
Codecov Report
@@ Coverage Diff @@
## master #1054 +/- ##
==========================================
+ Coverage 91.15% 91.18% +0.02%
==========================================
Files 50 50
Lines 6896 6928 +32
==========================================
+ Hits 6286 6317 +31
- Misses 610 611 +1 |
eda28f5 to
324a36e
Compare
324a36e to
fe080e8
Compare
|
|
||
| # List recently modified jobs for each state | ||
| if last is not None: | ||
| results['recent'] = {s: config.db.jobs.find({'$and': [match, {'state': s}]}, {'modified':1}).sort([('modified', pymongo.DESCENDING)]).limit(last) for s in JOB_STATES} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing N (job state) finds we could use a mongo aggregation pipeline that does a sort, followed by a group (by state), followed by a limit. I'm not convinced that would be faster on larger datasets but it's something to think about if this ends up being a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually looked into that, and it was slower - via the entirely scientific process of running each query a few times and checking the execution time. It was close though, and dev.fw may not be very representative for this either... It would at least be fewer round trips!
|
LGTM, I left an option for another route we could take if the recent jobs listing by state becomes a problem. |
Before:
After:
Before:
After: