Home | History | Annotate | Download | only in buildbot
      1 #!/usr/bin/env python
      2 # Copyright 2015 The Chromium Authors. All rights reserved.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 import logging
      7 import multiprocessing
      8 import sys
      9 import time
     10 import traceback
     11 
     12 import buildbot
     13 
     14 
     15 POLL_INTERVAL = 600
     16 BUILD_HISTORY_COUNT = 200
     17 BUILD_RESULTS_COUNT = 50
     18 
     19 
     20 def FetchLatestBuildResults(builder):
     21   try:
     22     builder.FetchRecentBuilds(BUILD_HISTORY_COUNT)
     23     print 'Fetching results for', builder
     24     for build in builder.LastBuilds(BUILD_RESULTS_COUNT):
     25       for step in build.steps.itervalues():
     26         step.results  # pylint: disable=pointless-statement
     27   except:  # multiprocessing doesn't give useful stack traces, so print it here.
     28     traceback.print_exc(file=sys.stderr)
     29     print
     30     raise
     31 
     32 
     33 def main():
     34   logging.getLogger().setLevel(logging.INFO)
     35   builders = buildbot.Builders('chromium.perf')
     36 
     37   process_pool = multiprocessing.Pool(4)
     38 
     39   while True:
     40     print 'Refreshing...'
     41     buildbot.Update('chromium.perf', builders)
     42     process_pool.map(FetchLatestBuildResults, builders.itervalues())
     43     print 'Refreshed!'
     44     time.sleep(POLL_INTERVAL)
     45 
     46 
     47 if __name__ == '__main__':
     48   main()
     49