Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: scripts/master/pubsub_json_status_push.py

Issue 2391913002: Add state and category to pubsub info (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import base64 5 import base64
6 import collections 6 import collections
7 import datetime 7 import datetime
8 import functools 8 import functools
9 import json 9 import json
10 import os 10 import os
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 for name, builder in builders.iteritems(): 371 for name, builder in builders.iteritems():
372 # This requires a deferred call since the data is queried from 372 # This requires a deferred call since the data is queried from
373 # the postgres DB (sigh). 373 # the postgres DB (sigh).
374 pending = yield builder.getPendingBuildRequestStatuses() 374 pending = yield builder.getPendingBuildRequestStatuses()
375 # Optimization cheat: only get the first 75 pending builds. 375 # Optimization cheat: only get the first 75 pending builds.
376 # This caps the amount of postgres db calls for really out of 376 # This caps the amount of postgres db calls for really out of
377 # control builders 377 # control builders
378 pending = pending[:75] 378 pending = pending[:75]
379 pendingStatues = yield defer.DeferredList( 379 pendingStatues = yield defer.DeferredList(
380 [p.asDict_async() for p in pending]) 380 [p.asDict_async() for p in pending])
381 # Not included: basedir, category, cachedBuilds, state. 381 # Not included: basedir, cachedBuilds.
382 # cachedBuilds isn't useful and takes a ton of resources to compute. 382 # cachedBuilds isn't useful and takes a ton of resources to compute.
383 builder_info = { 383 builder_info = {
384 'slaves': builder.slavenames, 384 'slaves': builder.slavenames,
385 'currentBuilds': sorted(b.getNumber() for b in builder.currentBuilds), 385 'currentBuilds': sorted(b.getNumber() for b in builder.currentBuilds),
386 'pendingBuilds': len(pending), 386 'pendingBuilds': len(pending),
387 'pendingBuildStatues': pendingStatues, 387 'pendingBuildStatues': pendingStatues,
388 'state': builder.getState()[0],
389 'category': builder.category,
388 } 390 }
389 builder_infos[name] = builder_info 391 builder_infos[name] = builder_info
390 392
391 slaves = {slave_name: self._status.getSlave(slave_name).asDict() 393 slaves = {slave_name: self._status.getSlave(slave_name).asDict()
392 for slave_name in self._status.getSlaveNames()} 394 for slave_name in self._status.getSlaveNames()}
393 defer.returnValue({ 395 defer.returnValue({
394 'builders': builder_infos, 'slaves': slaves, 'name': self.name}) 396 'builders': builder_infos, 'slaves': slaves, 'name': self.name})
395 397
396 398
397 def _recordBuild(self, build): 399 def _recordBuild(self, build):
(...skipping 22 matching lines...) Expand all
420 return self 422 return self
421 423
422 @event_handler 424 @event_handler
423 def stepStarted(self, build, _step): 425 def stepStarted(self, build, _step):
424 # This info is included in the master json. 426 # This info is included in the master json.
425 return self 427 return self
426 428
427 @event_handler 429 @event_handler
428 def buildFinished(self, _builderName, build, _results): 430 def buildFinished(self, _builderName, build, _results):
429 self._recordBuild(build) 431 self._recordBuild(build)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698