Skip to content
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

Process batch jobs grouped by email address #101

Merged
merged 1 commit into from
Nov 2, 2015
Merged
Changes from all commits
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
15 changes: 12 additions & 3 deletions mutalyzer/Scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,18 @@ def process(self):
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:
Expand Down