Skip to content
Snippets Groups Projects
Commit 0cdefdd3 authored by Vermaat's avatar Vermaat
Browse files

Merge pull request #101 from mutalyzer/schedule-by-email

Process batch jobs grouped by email address
parents 201d7deb 7e0db497
No related branches found
No related tags found
No related merge requests found
......@@ -364,9 +364,18 @@ Mutalyzer batch scheduler""" % url)
refers to the reason of alteration / skip.
"""
while not self.stopped():
batch_jobs = BatchJob.query
if batch_jobs.count() == 0:
# Group batch jobs by email address and retrieve the oldest for
# each address. This improves fairness when certain users have
# many jobs.
# Note that batch jobs submitted via the webservices all have the
# same email address, so they are effectively throttled as if all
# from the same user. Adapting the webservices to also allow
# setting an email address is future work.
batch_jobs = BatchJob.query.filter(BatchJob.id.in_(
session.query(func.min(BatchJob.id)).group_by(BatchJob.email))
).all()
if len(batch_jobs) == 0:
break
for batch_job in batch_jobs:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment