Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Add get latest jobs query #5

Merged
merged 3 commits into from
May 6, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mrq/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,11 @@ def trace_memory_stop(self):
w=1
)

def get_latest_jobs_with_query(query):
jobs = context.connections.mongodb_jobs.mrq_jobs
tasks = jobs.find(query)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Darking360 Would not it be nice to add the sort?

return tasks

def get_latest_job_with_query(query):
jobs = context.connections.mongodb_jobs.mrq_jobs
task = jobs.find_one(query, sort=[('datequeued', DESCENDING)])
Expand Down