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
|
- 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
|
- 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
|
- Turn into a server app
|
||||||
- Comment on classified failures saying what the issue probably is
|
|
||||||
- Make unit tests robust and not need internet
|
- Make unit tests robust and not need internet
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
|
@ -118,7 +118,7 @@ class Classifier():
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
print "build_name %s" % x["_source"]['@fields']['build_name']
|
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"""
|
"""Returns either None or a bug number"""
|
||||||
#Reload each time
|
#Reload each time
|
||||||
self.queries = json.loads(open('queries.json').read())
|
self.queries = json.loads(open('queries.json').read())
|
||||||
@ -134,11 +134,17 @@ class Classifier():
|
|||||||
print "Looking for bug: https://bugs.launchpad.net/bugs/%s" % x['bug']
|
print "Looking for bug: https://bugs.launchpad.net/bugs/%s" % x['bug']
|
||||||
query = self._apply_template(self.targeted_template, (x['query'],
|
query = self._apply_template(self.targeted_template, (x['query'],
|
||||||
change_number, patch_number))
|
change_number, patch_number))
|
||||||
results = self.es.search(query, size='1')
|
results = self.es.search(query, size='10')
|
||||||
if results['hits']['total']>0:
|
for result in results['hits']['hits']:
|
||||||
print "Found bug!"
|
url = result["_source"]['@fields']['log_url']
|
||||||
|
print result
|
||||||
|
if self._prep_url(url) in comment:
|
||||||
|
print "found bug!"
|
||||||
return x['bug']
|
return x['bug']
|
||||||
|
|
||||||
|
def _prep_url(self, url):
|
||||||
|
return '/'.join(url.split('/')[:-1])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
classifier = Classifier()
|
classifier = Classifier()
|
||||||
@ -150,7 +156,7 @@ def main():
|
|||||||
rev = event['patchSet']['number']
|
rev = event['patchSet']['number']
|
||||||
print "======================="
|
print "======================="
|
||||||
print "https://review.openstack.org/#/c/%(change)s/%(rev)s" % locals()
|
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:
|
if bug_number is None:
|
||||||
print "unable to classify failure"
|
print "unable to classify failure"
|
||||||
else:
|
else:
|
||||||
|
@ -17,6 +17,7 @@ class TestClassifier(testtools.TestCase):
|
|||||||
#self.assertFalse(True)
|
#self.assertFalse(True)
|
||||||
|
|
||||||
def test_classify(self):
|
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')
|
self.assertEqual(bug_number, '1211915')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user