You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2016/02/09 02:03:37 UTC
svn commit: r1729298 - /comdev/reporter.apache.org/trunk/scripts/health.py
Author: sebb
Date: Tue Feb 9 01:03:37 2016
New Revision: 1729298
URL: http://svn.apache.org/viewvc?rev=1729298&view=rev
Log:
New script to create health data
Added:
comdev/reporter.apache.org/trunk/scripts/health.py (with props)
Added: comdev/reporter.apache.org/trunk/scripts/health.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/health.py?rev=1729298&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/health.py (added)
+++ comdev/reporter.apache.org/trunk/scripts/health.py Tue Feb 9 01:03:37 2016
@@ -0,0 +1,235 @@
+"""
+ Generate health data file
+
+ Reads:
+ - data/releases/%s.json
+ - data/pmcs.json
+ - data/projects.json
+ - data/mailinglists.json
+ - data/maildata_extended.json
+ - https://whimsy.apache.org/public/committee-info.json via committee_info
+
+ Writes:
+ - data/health.json
+"""
+import json, time
+from os.path import join
+
+import committee_info
+
+RAO_DATA = '/var/www/reporter.apache.org/data'
+
+pmap = {
+ 'community': 'comdev',
+ 'ws': 'webservices',
+ 'hc': 'httpcomponents',
+ 'whimsical': 'whimsy',
+ 'empire': 'empire-db'
+}
+
+ldapmap = {
+ 'webservices': 'ws'
+}
+
+def getReleaseData(project):
+ try:
+ with open(join(RAO_DATA,"releases/%s.json") % project, "r") as f:
+ x = json.loads(f.read())
+ f.close()
+ return x;
+ except:
+ return {}
+
+pchanges = {}
+cchanges = {}
+
+with open(join(RAO_DATA,"pmcs.json"), "r") as f:
+ pchanges = json.loads(f.read())
+ f.close()
+
+with open(join(RAO_DATA,"projects.json"), "r") as f:
+ cchanges = json.loads(f.read())
+ f.close()
+
+groups = []
+
+afterQuarter = time.time() - (3*31*86400)
+afterHalf = time.time() - (6*31*86400)
+afterFull = time.time() - (12*31*86400)
+cdata = {}
+mlstats = {} # Populated, but does not appear to be used
+with open(join(RAO_DATA,"mailinglists.json"), "r") as f:
+ ml = json.loads(f.read())
+ f.close()
+ for entry in ml:
+ tlp = entry.split(".")[0] # e.g. lucene.apache.org-general => lucene
+ if tlp in pmap:
+ tlp = pmap[tlp]
+ if True:
+ mlstats[tlp] = mlstats[tlp] if tlp in mlstats else {}
+ mlstats[tlp][entry] = ml[entry]
+emails = {}
+with open(join(RAO_DATA,"maildata_extended.json"), "r") as f:
+ mld = json.loads(f.read())
+ f.close()
+ for entry in mld:
+ tlp = entry.split("-")[0]
+ if tlp in pmap:
+ tlp = pmap[tlp]
+ nentry = entry
+ if tlp == "empire":
+ tlp = "empire-db"
+ nentry = entry.replace("empire-", "empire-db-")
+ if True:
+ emails[tlp] = emails[tlp] if tlp in emails else {}
+ emails[tlp][nentry] = mld[entry]
+jdata = {}
+rdata = {}
+keys = {}
+count = {}
+pmcnames = committee_info.PMCnames()
+npmcs = {}
+ncoms = {}
+names = {}
+
+for group in pmcnames:
+ jiras = []
+ count[group] = [0,0]
+ xgroup = group
+ if group in ldapmap:
+ xgroup = ldapmap[group]
+ if xgroup in pchanges:
+ count[group][0] = len(pchanges[xgroup])
+ if xgroup in cchanges:
+ count[group][1] = len(cchanges[xgroup])
+ names[group] = pmcnames[group]
+ rdata[group] = getReleaseData(group)
+ cdata[group] = cdata[xgroup] if xgroup in cdata else {'pmc': {}, 'committer': {}}
+
+ for pmc in pchanges:
+ if pmc == xgroup:
+ for member in pchanges[pmc]:
+ if pchanges[pmc][member][1] > 0:
+ cdata[group]['pmc'][member] = pchanges[pmc][member]
+ npmcs[group] = npmcs[group] if (group in npmcs and npmcs[group] > pchanges[pmc][member][1]) else pchanges[pmc][member][1]
+ for pmc in cchanges:
+ if pmc == xgroup:
+ for member in cchanges[pmc]:
+ if cchanges[pmc][member][1] > 0:
+ cdata[group]['committer'][member] = cchanges[pmc][member]
+ ncoms[group] = ncoms[group] if (group in ncoms and ncoms[group] > cchanges[pmc][member][1]) else cchanges[pmc][member][1]
+
+notes = []
+status = [0,0,0,0,0,0]
+for group in sorted(pmcnames):
+ if group == "xmlbeans":
+ continue
+ x = 0
+ y = 0
+ score = 0
+ note = []
+ if group in emails:
+ for entry in emails[group]:
+ x += emails[group][entry]['quarterly'][0]
+ y += emails[group][entry]['quarterly'][1]
+ if x == 0:
+ score += 2.5
+ note.append("No email sent to ANY ML in the past quarter (-2.50氣)")
+ elif x < 4:
+ score += 2.25
+ note.append("Less than one email per month to all MLs combined in the past quarter (-2.25氣)")
+ elif x < 14:
+ score += 1.75
+ note.append("Less than one email per week to all MLs combined in the past quarter (-1.75氣)")
+ elif x < 45:
+ score += 1.5
+ note.append("Less than one email per 2 days to all MLs combined in the past quarter (-1.50氣)")
+ elif x < 92:
+ score += 1
+ note.append("Less than one email per day to all MLs combined in the past quarter (-1.00氣)")
+ elif x < 184:
+ score += 0.5
+ note.append("Less than two emails per day to all MLs combined in the past quarter (-0.50氣)")
+ elif x < 368:
+ score -= 0.5
+ note.append("More than 2 emails per day to all MLs combined in the past quarter (+0.50氣)")
+ elif x >= 368:
+ score -= 1
+ note.append("More than 4 emails per day to all MLs combined in the past quarter (+1.00氣)")
+ if (x+y) < 7:
+ score += 2
+ note.append("Less than one email per month sent to all MLs combined in the last six months (-2.00氣)")
+ elif y < 14 and x < 14:
+ score += 1.75
+ note.append("Less than one email per week to all MLs combined in the past six months (-1.75氣)")
+ elif y < 45 and x < 45:
+ score += 1.5
+ note.append("Less than one email per 2 days to all MLs combined in the past six months (-1.50氣)")
+ elif y < 90 and x < 90:
+ score += 1
+ note.append("Less than one email per day to all MLs combined in the past six months (-1.00氣)")
+ if group in rdata:
+ tooold = True if len(rdata[group]) > 0 else False
+ tooold2 = True if len(rdata[group]) > 0 else False
+ for version in rdata[group]:
+ if rdata[group][version] > afterFull:
+ tooold = False
+ if rdata[group][version] > (time.time() - (31536000*2)):
+ tooold2 = False
+ if tooold2:
+ score += 1.5
+ note.append("No releases in the last 2+ years (-1.50氣)")
+ elif tooold:
+ score += 1
+ note.append("No releases in the last year (-1.00氣)")
+
+ if len(rdata[group]) == 0:
+ score += 0.5
+ note.append("No release data available! (-0.50氣)")
+ if group in npmcs:
+ if npmcs[group] < afterFull:
+ score += 1
+ note.append("No new members added to the LDAP committee group for more than a year (-1.00氣)")
+ elif npmcs[group] < afterHalf:
+ score += 0.5
+ note.append("No new members added to the LDAP committee group for more than six months (-0.50氣)")
+ else:
+ score -= 0.5
+ note.append("New members() added to the LDAP committee group within the last six months (+0.50氣)")
+ elif group != "bookkeeper":
+ score += 2
+ note.append("No new members added to the LDAP committee group for more than 2 years (-2.00氣)")
+
+ if group in ncoms:
+ if ncoms[group] < afterFull:
+ score += 1
+ note.append("No new committers invited for more than a year (-1.00氣)")
+ elif ncoms[group] < afterHalf:
+ score += 0.5
+ note.append("No new committers invited for more than six months (-0.50氣)")
+ elif ncoms[group] < afterQuarter:
+ score -= 0.5
+ note.append("New committer(s) invited within the last six months (+0.50氣)")
+ else:
+ score -= 0.75
+ note.append("New committer(s) invited within the last three months (+0.75氣)")
+ elif group != "bookkeeper":
+ score += 2
+ note.append("No new committers invited for more than 2 years (-2.00氣)")
+
+ s = int(score/1.80)
+ if s > 4:
+ s = 4
+ s = s + 1
+ if s < 0:
+ s = 0
+ notes.append ({
+ 'pmc': names[group] if (group in names) else group,
+ 'score': score,
+ 'notes': note,
+ 'group': group,
+ 'cscore': s
+ })
+with open(join(RAO_DATA,"health.json"), "w") as f:
+ json.dump(notes, f, indent=1, sort_keys=True)
+ f.close()
Propchange: comdev/reporter.apache.org/trunk/scripts/health.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: comdev/reporter.apache.org/trunk/scripts/health.py
------------------------------------------------------------------------------
svn:executable = *