Skip to content

Instantly share code, notes, and snippets.

@indygreg
Last active December 21, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indygreg/6359423 to your computer and use it in GitHub Desktop.
Save indygreg/6359423 to your computer and use it in GitHub Desktop.
Obtain efficiency of buildbot slaves.
# The mozautomation package can be found at https://hg.mozilla.org/users/gszorc_mozilla.com/hgext-gecko-dev/
# Usage: python this_script.py 2013-08-25 4
import datetime
import sys
import time
from mozautomation.buildbotdata import BuildbotDump
start, count = sys.argv[1:]
year, month, day = start.split('-')
start_date = datetime.date(int(year), int(month), int(day))
b = BuildbotDump()
for i in range(int(count)):
delta = datetime.timedelta(i)
d = start_date + delta
b.load_date(d)
slave_groups = b.slave_groups()
print('Group\tSlave\t# Jobs\tTotal Duration\tEfficency')
for group in sorted(slave_groups.keys()):
for name in sorted(slave_groups[group]):
build_count, total_duration, active_percent = b.slave_efficiency(slave_name=name)
print('%s\t%s\t%d\t%d\t%2.f%%' % (group, name, build_count, total_duration,
active_percent * 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment