Use log_url to make sure looking at right job
This commit is contained in:
parent
9bef49d5c8
commit
1f06d02291
@ -13,9 +13,7 @@ Future Work
|
||||
------------
|
||||
- IRC bot output to #openstack-qa with output
|
||||
- Pull in list of queries from a more flexible source, so a commit isn't needed to update each time
|
||||
- https://bugs.launchpad.net/openstack-ci/+bug/1225108
|
||||
- Turn into a server app
|
||||
- Comment on classified failures saying what the issue probably is
|
||||
- Make unit tests robust and not need internet
|
||||
|
||||
Dependencies
|
||||
|
@ -118,7 +118,7 @@ class Classifier():
|
||||
except KeyError:
|
||||
print "build_name %s" % x["_source"]['@fields']['build_name']
|
||||
|
||||
def classify(self, change_number, patch_number):
|
||||
def classify(self, change_number, patch_number, comment):
|
||||
"""Returns either None or a bug number"""
|
||||
#Reload each time
|
||||
self.queries = json.loads(open('queries.json').read())
|
||||
@ -134,10 +134,16 @@ class Classifier():
|
||||
print "Looking for bug: https://bugs.launchpad.net/bugs/%s" % x['bug']
|
||||
query = self._apply_template(self.targeted_template, (x['query'],
|
||||
change_number, patch_number))
|
||||
results = self.es.search(query, size='1')
|
||||
if results['hits']['total']>0:
|
||||
print "Found bug!"
|
||||
return x['bug']
|
||||
results = self.es.search(query, size='10')
|
||||
for result in results['hits']['hits']:
|
||||
url = result["_source"]['@fields']['log_url']
|
||||
print result
|
||||
if self._prep_url(url) in comment:
|
||||
print "found bug!"
|
||||
return x['bug']
|
||||
|
||||
def _prep_url(self, url):
|
||||
return '/'.join(url.split('/')[:-1])
|
||||
|
||||
|
||||
def main():
|
||||
@ -150,7 +156,7 @@ def main():
|
||||
rev = event['patchSet']['number']
|
||||
print "======================="
|
||||
print "https://review.openstack.org/#/c/%(change)s/%(rev)s" % locals()
|
||||
bug_number = classifier.classify(change, rev)
|
||||
bug_number = classifier.classify(change, rev, event['comment'])
|
||||
if bug_number is None:
|
||||
print "unable to classify failure"
|
||||
else:
|
||||
|
@ -17,6 +17,7 @@ class TestClassifier(testtools.TestCase):
|
||||
#self.assertFalse(True)
|
||||
|
||||
def test_classify(self):
|
||||
bug_number = self.classifier.classify('46581', '1')
|
||||
bug_number = self.classifier.classify('43258', '13',
|
||||
' blah http://logs.openstack.org/58/43258/13/check/gate-tempest-devstack-vm-neutron/55a7887')
|
||||
self.assertEqual(bug_number, '1211915')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user