From 73053f997edfe64e0fbde9b1de27693d097dd357 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Thu, 23 Jan 2014 16:32:18 -0800 Subject: [PATCH] Make IRC messages provide more context Now that we are running this on all jobs (not just tempest) we are getting significantly more IRC messages. Add failed job name to logs to provide more context of what job is failing. For unclassified failures also include the queue (as a unclassified unit test failure in check queue is much less important then one in the gate). Change-Id: I485bf06721fa5afd102b99b26e38f12449deec7b --- elastic_recheck/bot.py | 14 ++++++++++---- elastic_recheck/elasticRecheck.py | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/elastic_recheck/bot.py b/elastic_recheck/bot.py index da03463f..3e14621f 100755 --- a/elastic_recheck/bot.py +++ b/elastic_recheck/bot.py @@ -115,13 +115,19 @@ class RecheckWatch(threading.Thread): LPCACHEDIR) def new_error(self, channel, event): - msg = '%s change: %s failed with an unrecognized error' % ( - event.project, event.url) + msg = ('%s change: %s failed %s in the %s queue with an unrecognized ' + 'error' % (event.project, + event.url, + ', '.join(event.failed_jobs), + event.queue())) self.print_msg(channel, msg) def error_found(self, channel, event): - msg = ('%s change: %s failed tempest because of: %s' % ( - event.project, event.url, event.bug_urls())) + msg = ('%s change: %s failed %s because of: %s' % ( + event.project, + event.url, + ", ".join(event.failed_jobs), + event.bug_urls())) display = False for project in self._get_bug_projects(event.bugs): if channel in self.channel_config.projects['all']: diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index 4e4f28ee..8d3941d3 100755 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -76,13 +76,16 @@ class FailEvent(object): bugs = set([]) short_build_uuids = [] comment = None + failed_jobs = {} - def __init__(self, event): + def __init__(self, event, failed_jobs): self.change = event['change']['number'] self.rev = event['patchSet']['number'] self.project = event['change']['project'] self.url = event['change']['url'] self.comment = event["comment"] + #TODO(jogo) make FailEvent generate the jobs + self.failed_jobs = failed_jobs self.bugs = set([]) def is_openstack_project(self): @@ -95,6 +98,13 @@ class FailEvent(object): urls = ['https://bugs.launchpad.net/bugs/%s' % x for x in self.bugs] return ' and '.join(urls) + def queue(self): + # Assume one queue per gerrit event + if len(self.failed_jobs) == 0: + return None + return self.failed_jobs[ + self.failed_jobs.keys()[0]]['url'].split('/')[6] + class Stream(object): """Gerrit Stream. @@ -234,7 +244,7 @@ class Stream(object): # nothing to see here, lets try the next event continue - fevent = FailEvent(event) + fevent = FailEvent(event, failed_jobs) # bail if it's not an openstack project if not fevent.is_openstack_project():