19a90cd40c6e510484e018afd087a4c239b616ee0Brian Paul#!/usr/bin/env python 29a90cd40c6e510484e018afd087a4c239b616ee0Brian Paul# Copyright 2015 The Chromium Authors. All rights reserved. 39a90cd40c6e510484e018afd087a4c239b616ee0Brian Paul# Use of this source code is governed by a BSD-style license that can be 47943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul# found in the LICENSE file. 59f23a3a1bff6c8af93e651273c9887bbf119f555Ian Romanick 67943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulimport logging 77943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulimport multiprocessing 87943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulimport sys 97943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulimport time 107943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulimport traceback 117943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 127943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulimport buildbot 137943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 147943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 157943b349d696f8030f0d2f836ad42a762f4c6026Brian PaulPOLL_INTERVAL = 600 167943b349d696f8030f0d2f836ad42a762f4c6026Brian PaulBUILD_HISTORY_COUNT = 200 177943b349d696f8030f0d2f836ad42a762f4c6026Brian PaulBUILD_RESULTS_COUNT = 50 187943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 197943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 207943b349d696f8030f0d2f836ad42a762f4c6026Brian Pauldef FetchLatestBuildResults(builder): 217943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul try: 227943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul builder.FetchRecentBuilds(BUILD_HISTORY_COUNT) 237943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul print 'Fetching results for', builder 247943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul for build in builder.LastBuilds(BUILD_RESULTS_COUNT): 257943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul for step in build.steps.itervalues(): 267943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul step.results # pylint: disable=pointless-statement 277943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul except: # multiprocessing doesn't give useful stack traces, so print it here. 28462183fe4cb6df6d90632d9e2cee881c8d26b1cbAlan Hourihane traceback.print_exc(file=sys.stderr) 29462183fe4cb6df6d90632d9e2cee881c8d26b1cbAlan Hourihane print 30462183fe4cb6df6d90632d9e2cee881c8d26b1cbAlan Hourihane raise 317943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 327943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 337943b349d696f8030f0d2f836ad42a762f4c6026Brian Pauldef main(): 347943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul logging.getLogger().setLevel(logging.INFO) 357943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul builders = buildbot.Builders('chromium.perf') 367943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 377943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul process_pool = multiprocessing.Pool(4) 387943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 397943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul while True: 407943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul print 'Refreshing...' 417943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul buildbot.Update('chromium.perf', builders) 427943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul process_pool.map(FetchLatestBuildResults, builders.itervalues()) 437943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul print 'Refreshed!' 447943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul time.sleep(POLL_INTERVAL) 457943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 467943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul 477943b349d696f8030f0d2f836ad42a762f4c6026Brian Paulif __name__ == '__main__': 487943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul main() 497943b349d696f8030f0d2f836ad42a762f4c6026Brian Paul