Skip to content

Commit

Permalink
Fix cron URL. Modify email message to only send at most 50 errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlip committed Sep 7, 2014
1 parent 34053ab commit cf714f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions core/controllers/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ class JobStatusMailerHandler(base.BaseHandler):
def get(self):
"""Handles GET requests."""
TWENTY_FIVE_HOURS_IN_MSECS = 25 * 60 * 60 * 1000
MAX_JOBS_TO_REPORT_ON = 50

# TODO(sll): Get the 50 most recent failed shards, not all of them.
failed_jobs = jobs.get_stuck_jobs(TWENTY_FIVE_HOURS_IN_MSECS)
if failed_jobs:
email_subject = 'MapReduce failure alert'
email_message = (
'Some jobs have failed in the past 25 hours. '
'More information:')
'%s jobs have failed in the past 25 hours. More information '
'(about at most %s jobs; to see more, please check the logs):'
) % len(failed_jobs, MAX_JOBS_TO_REPORT_ON)

for job in failed_jobs:
for job in failed_jobs[:MAX_JOBS_TO_REPORT_ON]:
email_message += '\n'
email_message += '-----------------------------------'
email_message += '\n'
Expand Down
2 changes: 1 addition & 1 deletion cron.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cron:
- description: daily email about mapreduce job statuses
url: /mail/admin/job_status
url: /cron/mail/admin/job_status
schedule: every day 16:00

0 comments on commit cf714f4

Please sign in to comment.