Work on reporting.
This commit is contained in:
parent
e265109dcc
commit
c8ad51b188
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import sys
|
||||
import urllib
|
||||
|
||||
|
||||
CI_SYSTEM = ['Jenkins',
|
||||
'turbo-hipster',
|
||||
'Hyper-V CI',
|
||||
'VMware Mine Sweeper',
|
||||
'Docker CI',
|
||||
'NEC OpenStack CI']
|
||||
|
||||
|
||||
def read_remote_lines(url):
|
||||
remote = urllib.urlopen(url)
|
||||
data = ''
|
||||
while True:
|
||||
d = remote.read(100)
|
||||
if not d:
|
||||
break
|
||||
|
||||
data += d
|
||||
|
||||
if data.find('\n') != -1:
|
||||
elems = data.split('\n')
|
||||
for line in elems[:-1]:
|
||||
yield line
|
||||
data = elems[-1]
|
||||
|
||||
if data:
|
||||
yield data
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
patchsets = {}
|
||||
skipped_authors = {}
|
||||
day = datetime.datetime.now()
|
||||
day -= datetime.timedelta(days=7)
|
||||
|
||||
while day < datetime.datetime.now():
|
||||
print 'Processing %s/%s/%s' % (day.year, day.month, day.day)
|
||||
for line in read_remote_lines('http://www.rcbops.com/gerrit/merged/'
|
||||
'%s/%s/%s'
|
||||
% (day.year, day.month, day.day)):
|
||||
try:
|
||||
j = json.loads(line)
|
||||
except:
|
||||
continue
|
||||
|
||||
try:
|
||||
if not 'change' in j:
|
||||
continue
|
||||
if j['change']['project'] != 'openstack/nova':
|
||||
continue
|
||||
|
||||
if j['type'] == 'patchset-created':
|
||||
number = j['change']['number']
|
||||
patchset = j['patchSet']['number']
|
||||
timestamp = j['patchSet']['createdOn']
|
||||
patchsets['%s,%s' % (number, patchset)] = \
|
||||
{'__created__': timestamp}
|
||||
|
||||
elif j['type'] == 'comment-added':
|
||||
if not 'approvals' in j:
|
||||
j['approvals'] = [{'type': 'CRVW', 'value': 0}]
|
||||
|
||||
author = j['author']['name']
|
||||
if not author in CI_SYSTEM:
|
||||
skipped_authors.setdefault(author, 0)
|
||||
skipped_authors[author] += 1
|
||||
continue
|
||||
|
||||
number = j['change']['number']
|
||||
patchset = j['patchSet']['number']
|
||||
timestamp = j['patchSet']['createdOn']
|
||||
|
||||
verified = []
|
||||
for approval in j['approvals']:
|
||||
verified.append('%s:%s' % (approval['type'],
|
||||
approval.get('value')))
|
||||
|
||||
key = '%s,%s' % (number, patchset)
|
||||
patchsets.setdefault(key, {})
|
||||
patchsets[key][author] = (timestamp, verified)
|
||||
|
||||
elif j['type'] in ['change-abandoned',
|
||||
'change-merged',
|
||||
'change-restored',
|
||||
'ref-updated']:
|
||||
pass
|
||||
|
||||
else:
|
||||
print json.dumps(j, indent=4)
|
||||
sys.exit(0)
|
||||
|
||||
except Exception, e:
|
||||
print 'Error: %s\n' % e
|
||||
print json.dumps(j, indent=4)
|
||||
sys.exit(0)
|
||||
|
||||
day += datetime.timedelta(days=1)
|
||||
|
||||
# Write some json blobs, which are intended mostly for debugging
|
||||
with open('patchsets.json', 'w') as f:
|
||||
f.write(json.dumps(patchsets, indent=4))
|
||||
with open('skipped.json', 'w') as f:
|
||||
f.write(json.dumps(skipped_authors, indent=4))
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open('patchsets.json') as f:
|
||||
patchsets = json.loads(f.read())
|
||||
|
||||
# Summarize
|
||||
timeslots = {}
|
||||
for patchset in patchsets:
|
||||
if not '__created__' in patchsets[patchset]:
|
||||
continue
|
||||
created = patchsets[patchset]['__created__']
|
||||
|
||||
created_dt = datetime.datetime.fromtimestamp(created)
|
||||
timeslot = datetime.datetime(created_dt.year,
|
||||
created_dt.month,
|
||||
created_dt.day,
|
||||
created_dt.hour).strftime('%Y%m%d %H%M')
|
||||
|
||||
timeslots.setdefault(timeslot, {})
|
||||
timeslots[timeslot].setdefault('__total__', 0)
|
||||
timeslots[timeslot]['__total__'] += 1
|
||||
|
||||
for author in patchsets[patchset]:
|
||||
if author == '__created__':
|
||||
continue
|
||||
|
||||
author_vote = json.dumps((author, patchsets[patchset][author][1]))
|
||||
timeslots[timeslot].setdefault(author_vote, 0)
|
||||
timeslots[timeslot][author_vote] += 1
|
||||
|
||||
#print '%s,%s,%s,%s' %(patchset,
|
||||
# author,
|
||||
# patchsets[patchset][author][0] - created,
|
||||
# patchsets[patchset][author][1])
|
||||
|
||||
# Report
|
||||
for timeslot in sorted(timeslots.keys()):
|
||||
authors = {}
|
||||
for author_vote in timeslots[timeslot]:
|
||||
if author_vote == '__total__':
|
||||
continue
|
||||
|
||||
try:
|
||||
author, vote = json.loads(author_vote)
|
||||
count = timeslots[timeslot][author_vote]
|
||||
|
||||
authors.setdefault(author, {})
|
||||
authors[author].setdefault('+', 0)
|
||||
authors[author].setdefault('-', 0)
|
||||
authors[author].setdefault('0', 0)
|
||||
authors[author].setdefault('?', 0)
|
||||
|
||||
clean_votes = []
|
||||
for single in vote:
|
||||
if not single.endswith(':0'):
|
||||
clean_votes.append(single)
|
||||
vote = clean_votes
|
||||
|
||||
if len(vote) > 1:
|
||||
print '*** Multiple vote %s ***' % vote
|
||||
v = '?'
|
||||
elif len(vote) == 0:
|
||||
v = '0'
|
||||
else:
|
||||
vote = vote[0]
|
||||
votetype, votevalue = vote.split(':')
|
||||
if votevalue in ['1', '2']:
|
||||
v = '+'
|
||||
elif votevalue in ['-1', '-2']:
|
||||
v = '-'
|
||||
else:
|
||||
v = '0'
|
||||
authors[author][v] += count
|
||||
|
||||
except Exception, e:
|
||||
print '*** Could not decode %s (%s) ***' % (author_vote, e)
|
||||
|
||||
sys.stdout.write('%s ' % timeslot)
|
||||
for author in authors:
|
||||
sys.stdout.write('%s(' % author)
|
||||
votes = []
|
||||
for vote in ['-', '0', '+', '?']:
|
||||
votes.append('%s' % authors[author][vote])
|
||||
sys.stdout.write(','.join(votes))
|
||||
sys.stdout.write(') ')
|
||||
sys.stdout.write('\n')
|
|
@ -0,0 +1,184 @@
|
|||
{
|
||||
"Ailing Zhang": 1,
|
||||
"Dan Prince": 11,
|
||||
"Baodong (Robert) Li": 2,
|
||||
"Andrew Laski": 16,
|
||||
"Ryan Hsu": 8,
|
||||
"Daniel Kuffner": 2,
|
||||
"Maithem": 3,
|
||||
"Shane Wang": 4,
|
||||
"Dirk Mueller": 1,
|
||||
"Jason Dillaman": 1,
|
||||
"Subbu": 4,
|
||||
"Cedric Brandily": 1,
|
||||
"Facundo Farias": 2,
|
||||
"Sridevi Koushik": 1,
|
||||
"Monty Taylor": 2,
|
||||
"jan grant": 2,
|
||||
"Sabari Murugesan": 1,
|
||||
"Eric Harney": 1,
|
||||
"John Warren": 1,
|
||||
"Xiang Hui": 1,
|
||||
"Yuiko Takada": 3,
|
||||
"Christopher Yeoh": 35,
|
||||
"Sean Dague": 8,
|
||||
"Alan Kavanagh": 1,
|
||||
"Eric Brown": 3,
|
||||
"Noorul Islam K M": 1,
|
||||
"Pavel Kirpichyov": 1,
|
||||
"Ryan Moore": 1,
|
||||
"Josh Durgin": 1,
|
||||
"Andrea Rosa": 6,
|
||||
"Ionut Artarisi": 1,
|
||||
"Alvaro Lopez Garcia": 3,
|
||||
"Sidharth Surana": 8,
|
||||
"Inbar Shapira": 2,
|
||||
"lawrancejing": 1,
|
||||
"Marcos Ferm\u00edn Lobo": 3,
|
||||
"Sean M. Collins": 2,
|
||||
"Guillaume Thouvenin": 7,
|
||||
"Steve Kowalik": 1,
|
||||
"jichenjc": 36,
|
||||
"Juan Manuel Oll\u00e9": 1,
|
||||
"Ken'ichi Ohmichi": 53,
|
||||
"Leandro Ignacio Costantino": 7,
|
||||
"Michael Still": 35,
|
||||
"Mikhail Durnosvistov": 1,
|
||||
"Chris Krelle": 3,
|
||||
"Shlomi Sasson": 2,
|
||||
"timello": 1,
|
||||
"Kravchenko Pavel": 1,
|
||||
"wingwj": 2,
|
||||
"Hirofumi Ichihara": 1,
|
||||
"Aditi Raveesh": 3,
|
||||
"Roman Vyalov": 1,
|
||||
"\u00c9douard Thuleau": 2,
|
||||
"Vui Lam": 9,
|
||||
"Solly Ross": 2,
|
||||
"Qiu Yu": 14,
|
||||
"Xavier Queralt": 4,
|
||||
"Jaesang Lee": 1,
|
||||
"Nikola Dipanov": 12,
|
||||
"Bob Ball": 7,
|
||||
"Jay Lau": 65,
|
||||
"sahid": 35,
|
||||
"XiaoLiang Hu": 1,
|
||||
"Telles Mota Vidal N\u00f3brega": 4,
|
||||
"Geza Gemes": 2,
|
||||
"Rick Harris": 3,
|
||||
"Matt Dietz": 16,
|
||||
"Paul Murray": 6,
|
||||
"mark mcclain": 1,
|
||||
"Clark Boylan": 1,
|
||||
"Alessandro Pilotti": 14,
|
||||
"Liyi Meng": 1,
|
||||
"Lee Yarwood": 1,
|
||||
"xing-yang": 1,
|
||||
"John Haan": 3,
|
||||
"Zhi Yan Liu": 2,
|
||||
"Boris Pavlovic": 1,
|
||||
"Christopher Lefelhocz": 1,
|
||||
"Khanh-Toan TRAN": 3,
|
||||
"Elastic Recheck": 61,
|
||||
"Kaitlin Farr": 3,
|
||||
"xu-haiwei": 19,
|
||||
"Alexander Gorodnev": 4,
|
||||
"yasunori jitsukawa": 2,
|
||||
"Mathew Odden": 2,
|
||||
"Tracy Jones": 3,
|
||||
"Alexey Ovchinnikov": 6,
|
||||
"dave-mcnally": 4,
|
||||
"Shuangtai Tian": 24,
|
||||
"Xinyuan Huang": 1,
|
||||
"Ghe Rivero": 2,
|
||||
"Sreeram Yerrapragada": 2,
|
||||
"lifeless": 5,
|
||||
"Russell Bryant": 50,
|
||||
"Vish Ishaya": 1,
|
||||
"Aaron Rosen": 9,
|
||||
"John Garbutt": 11,
|
||||
"Sylvain Bauza": 1,
|
||||
"David Xie": 1,
|
||||
"Doug Hellmann": 1,
|
||||
"Roman Bogorodskiy": 2,
|
||||
"S\u00e9bastien Han": 2,
|
||||
"Debo~ Dutta": 1,
|
||||
"Sumanth Nagadavalli": 1,
|
||||
"Joshua Hesketh": 32,
|
||||
"liusheng": 4,
|
||||
"Daniel Berrange": 80,
|
||||
"Alex Xu": 8,
|
||||
"Vincent Untz": 1,
|
||||
"Wangpan": 12,
|
||||
"Sabari": 27,
|
||||
"Sergey Vilgelm": 1,
|
||||
"Phil Day": 7,
|
||||
"David Ripton": 29,
|
||||
"Melanie Witt": 1,
|
||||
"Mark McLoughlin": 26,
|
||||
"Eiichi Aikawa": 13,
|
||||
"Edward Hope-Morley": 4,
|
||||
"Chris Behrens": 15,
|
||||
"Alexis Lee": 1,
|
||||
"Kiyohiro Adachi": 1,
|
||||
"Arnaud Legendre": 5,
|
||||
"Yathiraj Udupi": 2,
|
||||
"Matt Riedemann": 53,
|
||||
"Matt Fischer": 1,
|
||||
"Pedro Marques": 1,
|
||||
"Radoslav Gerganov": 19,
|
||||
"Trivial Rebase": 35,
|
||||
"Gast\u00f3n Severina": 1,
|
||||
"Devananda van der Veen": 5,
|
||||
"Lin Tan": 8,
|
||||
"ChangBo Guo": 1,
|
||||
"Chen Xiao": 2,
|
||||
"Michael H Wilson": 2,
|
||||
"Lucas Alvares Gomes": 2,
|
||||
"Chris Buccella": 4,
|
||||
"Li Yingjun": 5,
|
||||
"David Jia": 1,
|
||||
"Venkatesh Sampath": 1,
|
||||
"Matthew Gilliard": 27,
|
||||
"LaunchpadSync": 74,
|
||||
"Ilya Pekelny": 1,
|
||||
"Rafael Folco": 2,
|
||||
"Hans Lindgren": 5,
|
||||
"Petrut Lucian": 2,
|
||||
"Ben Nemec": 3,
|
||||
"Joe Gordon": 37,
|
||||
"Dong Liu": 1,
|
||||
"Robert Tingirica": 1,
|
||||
"garyk": 147,
|
||||
"Alex Glikson": 1,
|
||||
"Brian Elliott": 7,
|
||||
"ijw-ubuntu": 2,
|
||||
"justinsb": 4,
|
||||
"haruka tanizawa": 2,
|
||||
"Roman Podoliaka": 1,
|
||||
"Michael Davies": 12,
|
||||
"p-draigbrady": 9,
|
||||
"Yaguang Tang": 5,
|
||||
"Matthew Booth": 8,
|
||||
"Dmitry Shulyak": 1,
|
||||
"lizheming": 2,
|
||||
"Victor Sergeyev": 6,
|
||||
"Haomeng,Wang": 1,
|
||||
"Dan Smith": 54,
|
||||
"gongysh": 2,
|
||||
"Tiantian Gao": 3,
|
||||
"Richard Jones": 1,
|
||||
"Kevin L. Mitchell": 30,
|
||||
"Vladik Romanovsky": 10,
|
||||
"Sam Morrison": 1,
|
||||
"Shawn Hartsock": 8,
|
||||
"Dazhao Yu": 2,
|
||||
"Aneesh Puliyedath Udumbath": 1,
|
||||
"Matthew Oliver": 1,
|
||||
"Lianhao Lu": 6,
|
||||
"Angus Salkeld": 2,
|
||||
"huangtianhua": 3,
|
||||
"Rushi Agrawal": 3,
|
||||
"Alan Pevec": 5,
|
||||
"Sandy Walsh": 1
|
||||
}
|
Loading…
Reference in New Issue