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

Unified Diff: scripts/master/buildbucket/integration.py

Issue 2157703002: buildbucket: support unique change urls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: nits Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/master/buildbucket/changestore.py ('k') | scripts/master/buildbucket/unittests/changestore_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/master/buildbucket/integration.py
diff --git a/scripts/master/buildbucket/integration.py b/scripts/master/buildbucket/integration.py
index 813b201c8c846892304ec38b524f59fb7f6a08c4..b845d0670f90541629dc146cf5a31995dc0cc95a 100644
--- a/scripts/master/buildbucket/integration.py
+++ b/scripts/master/buildbucket/integration.py
@@ -5,14 +5,11 @@
"""BuildBucketIntegrator integrates Buildbot and Buildbucket."""
import datetime
-import itertools
import json
import logging
-import traceback
from buildbot.util import deferredLocked
-from master.buildbucket import common, changestore
-from master.buildbucket.common import log
+from master.buildbucket import changestore
from twisted.internet import defer, reactor
from twisted.internet.defer import inlineCallbacks, returnValue
@@ -54,7 +51,7 @@ class BuildBucketIntegrator(object):
def __init__(
self, buckets, build_params_hook=None, max_lease_count=None,
- heartbeat_interval=None):
+ heartbeat_interval=None, change_store_factory=None):
"""Creates a BuildBucketIntegrator.
Args:
@@ -70,6 +67,7 @@ class BuildBucketIntegrator(object):
time. Defaults to the number of connected slaves.
heartbeat_interval (datetime.timedelta): frequency of build heartbeats.
Defaults to 1 minute.
+ change_store_factory: function (BuildbotGateway) => ChangeStore.
"""
assert buckets, 'Buckets not specified'
assert max_lease_count is None or isinstance(max_lease_count, int)
@@ -86,6 +84,7 @@ class BuildBucketIntegrator(object):
self._max_lease_count = max_lease_count
self._leases = None
self.heartbeat_interval = heartbeat_interval or DEFAULT_HEARTBEAT_INTERVAL
+ self.change_store_factory = change_store_factory or changestore.ChangeStore
def get_max_lease_count(self):
if self._max_lease_count:
@@ -97,15 +96,14 @@ class BuildBucketIntegrator(object):
def log(self, message, level=None):
common.log(message, level)
- def start(self, buildbot, buildbucket_service, change_store_factory=None):
+ def start(self, buildbot, buildbucket_service):
assert not self.started, 'BuildBucketIntegrator is already started'
assert buildbot
assert buildbucket_service
- change_store_factory = change_store_factory or changestore.ChangeStore
self.buildbot = buildbot
self.buildbucket_service = buildbucket_service
self.buildbucket_service.start()
- self.changes = change_store_factory(buildbot)
+ self.changes = self.change_store_factory(buildbot)
self.started = True
self.log('integrator started')
self._do_until_stopped(self.heartbeat_interval, self.send_heartbeats)
« no previous file with comments | « scripts/master/buildbucket/changestore.py ('k') | scripts/master/buildbucket/unittests/changestore_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698