Exemple #1
0
    def __init__(self, db_url, basedir):
        self.basedir = basedir
        "basedir for this master - used for upgrades"

        self._engine = enginestrategy.create_engine(db_url, basedir=self.basedir)
        self.pool = pool.DBThreadPool(self._engine)
        "thread pool (L{buildbot.db.pool.DBThreadPool}) for this db"

        self._oldpool = TempAdbapiPool(self._engine)

        self._query_times = collections.deque()

        self._change_cache = util.LRUCache() # TODO: remove
        self._sourcestamp_cache = util.LRUCache()
        self._active_operations = set() # protected by synchronized=
        self._pending_notifications = []
        self._subscribers = bbcollections.defaultdict(set)

        self._pending_operation_count = 0

        self._started = False

        # set up components
        self.model = model.Model(self)
        "L{buildbot.db.model.Model} instance"

        self.changes = changes.ChangesConnectorComponent(self)
        "L{buildbot.db.changes.ChangesConnectorComponent} instance"
Exemple #2
0
    def __init__(self,
                 name,
                 shouldntBeSet=NotSet,
                 treeStableTimer=None,
                 builderNames=None,
                 branch=NotABranch,
                 branches=NotABranch,
                 fileIsImportant=None,
                 properties={},
                 categories=None,
                 change_filter=None):
        assert shouldntBeSet is self.NotSet, \
                "pass arguments to schedulers using keyword arguments"
        if fileIsImportant:
            assert callable(fileIsImportant)

        # initialize parent classes
        base.BaseScheduler.__init__(self, name, builderNames, properties)

        self.treeStableTimer = treeStableTimer
        self.fileIsImportant = fileIsImportant
        self.change_filter = self.getChangeFilter(branch=branch,
                                                  branches=branches,
                                                  change_filter=change_filter,
                                                  categories=categories)

        # the IDelayedCall used to wake up when this scheduler's
        # treeStableTimer expires.
        self._stable_timers = collections.defaultdict(lambda: None)
        self._stable_timers_lock = defer.DeferredLock()
Exemple #3
0
    def __init__(self, spec):
        # typical args = (dbmodule, dbname, username, password)
        self._query_times = collections.deque()
        self._spec = spec

        # this is for synchronous calls: runQueryNow, runInteractionNow
        self._dbapi = spec.get_dbapi()
        self._nonpool = None
        self._nonpool_lastused = None
        self._nonpool_max_idle = spec.get_maxidle()

        # pass queries in with "?" placeholders. If the backend uses a
        # different style, we'll replace them.
        self.paramstyle = self._dbapi.paramstyle

        self._pool = spec.get_async_connection_pool()
        self._pool.transactionFactory = MyTransaction
        # the pool must be started before it can be used. The real
        # buildmaster process will do this at reactor start. CLI tools (like
        # "buildbot upgrade-master") must do it manually. Unit tests are run
        # in an environment in which it is already started.

        self._change_cache = util.LRUCache()
        self._sourcestamp_cache = util.LRUCache()
        self._active_operations = set() # protected by synchronized=
        self._pending_notifications = []
        self._subscribers = bbcollections.defaultdict(set)

        self._pending_operation_count = 0

        self._started = False
Exemple #4
0
    def __init__(self, spec):
        # typical args = (dbmodule, dbname, username, password)
        self._query_times = collections.deque()
        self._spec = spec

        # this is for synchronous calls: runQueryNow, runInteractionNow
        self._dbapi = spec.get_dbapi()
        self._nonpool = None
        self._nonpool_lastused = None
        self._nonpool_max_idle = spec.get_maxidle()

        # pass queries in with "?" placeholders. If the backend uses a
        # different style, we'll replace them.
        self.paramstyle = self._dbapi.paramstyle

        self._pool = spec.get_async_connection_pool()
        self._pool.transactionFactory = MyTransaction
        # the pool must be started before it can be used. The real
        # buildmaster process will do this at reactor start. CLI tools (like
        # "buildbot upgrade-master") must do it manually. Unit tests are run
        # in an environment in which it is already started.

        self._change_cache = util.LRUCache()
        self._sourcestamp_cache = util.LRUCache()
        self._active_operations = set()  # protected by synchronized=
        self._pending_notifications = []
        self._subscribers = bbcollections.defaultdict(set)

        self._pending_operation_count = 0

        self._started = False
Exemple #5
0
 def _attach(ign):
     for s in added:
         s.setServiceParent(self)
     self.upstream_subscribers = collections.defaultdict(list)
     for s in list(self):
         if s.upstream_name:
             self.upstream_subscribers[s.upstream_name].append(s)
     eventually(self.trigger)
Exemple #6
0
 def _attach(ign):
     for s in added:
         s.setServiceParent(self)
     self.upstream_subscribers = collections.defaultdict(list)
     for s in list(self):
         if s.upstream_name:
             self.upstream_subscribers[s.upstream_name].append(s)
     eventually(self.trigger)
Exemple #7
0
    def __init__(self, master, db_url, basedir):
        service.MultiService.__init__(self)
        self.master = master
        self.basedir = basedir
        "basedir for this master - used for upgrades"

        self._engine = enginestrategy.create_engine(db_url,
                                                    basedir=self.basedir)
        self.pool = pool.DBThreadPool(self._engine)
        "thread pool (L{buildbot.db.pool.DBThreadPool}) for this db"

        self._oldpool = TempAdbapiPool(self._engine)

        self._sourcestamp_cache = util.LRUCache()  # TODO: remove
        self._active_operations = set(
        )  # protected by synchronized= TODO: remove
        self._pending_notifications = []  # TODO: remove
        self._subscribers = bbcollections.defaultdict(set)

        self._started = False

        # set up components
        self.model = model.Model(self)
        "L{buildbot.db.model.Model} instance"

        self.changes = changes.ChangesConnectorComponent(self)
        "L{buildbot.db.changes.ChangesConnectorComponent} instance"

        self.schedulers = schedulers.SchedulersConnectorComponent(self)
        "L{buildbot.db.schedulers.ChangesConnectorComponent} instance"

        self.sourcestamps = sourcestamps.SourceStampsConnectorComponent(self)
        "L{buildbot.db.sourcestamps.SourceStampsConnectorComponent} instance"

        self.buildsets = buildsets.BuildsetsConnectorComponent(self)
        "L{buildbot.db.sourcestamps.BuildsetsConnectorComponent} instance"

        self.buildrequests = buildrequests.BuildRequestsConnectorComponent(
            self)
        "L{buildbot.db.sourcestamps.BuildRequestsConnectorComponent} instance"

        self.state = state.StateConnectorComponent(self)
        "L{buildbot.db.state.StateConnectorComponent} instance"

        self.cleanup_timer = internet.TimerService(self.CLEANUP_PERIOD,
                                                   self.doCleanup)
        self.cleanup_timer.setServiceParent(self)

        self.changeHorizon = None  # default value; set by master
    def __init__(self, master, db_url, basedir):
        service.MultiService.__init__(self)
        self.master = master
        self.basedir = basedir
        "basedir for this master - used for upgrades"

        self._engine = enginestrategy.create_engine(db_url, basedir=self.basedir)
        self.pool = pool.DBThreadPool(self._engine)
        "thread pool (L{buildbot.db.pool.DBThreadPool}) for this db"

        self._oldpool = TempAdbapiPool(self._engine)

        self._sourcestamp_cache = util.LRUCache() # TODO: remove
        self._active_operations = set() # protected by synchronized= TODO: remove
        self._pending_notifications = [] # TODO: remove
        self._subscribers = bbcollections.defaultdict(set)

        self._started = False

        # set up components
        self.model = model.Model(self)
        "L{buildbot.db.model.Model} instance"

        self.changes = changes.ChangesConnectorComponent(self)
        "L{buildbot.db.changes.ChangesConnectorComponent} instance"

        self.schedulers = schedulers.SchedulersConnectorComponent(self)
        "L{buildbot.db.schedulers.ChangesConnectorComponent} instance"

        self.sourcestamps = sourcestamps.SourceStampsConnectorComponent(self)
        "L{buildbot.db.sourcestamps.SourceStampsConnectorComponent} instance"

        self.buildsets = buildsets.BuildsetsConnectorComponent(self)
        "L{buildbot.db.sourcestamps.BuildsetsConnectorComponent} instance"

        self.buildrequests = buildrequests.BuildRequestsConnectorComponent(self)
        "L{buildbot.db.sourcestamps.BuildRequestsConnectorComponent} instance"

        self.state = state.StateConnectorComponent(self)
        "L{buildbot.db.state.StateConnectorComponent} instance"

        self.cleanup_timer = internet.TimerService(self.CLEANUP_PERIOD, self.doCleanup)
        self.cleanup_timer.setServiceParent(self)

        self.changeHorizon = None # default value; set by master
    def __init__(self, spec):
        # self._query_times = collections.deque()
        self._spec = spec

        # this is for synchronous calls: runQueryNow, runInteractionNow
        self._dbapi = spec.get_dbapi()
        self._nonpool = None
        self._nonpool_lastused = None
        self._nonpool_max_idle = spec.get_maxidle()

        self._change_cache = util.LRUCache()
        self._sourcestamp_cache = util.LRUCache()
        self._active_operations = set() # protected by synchronized=
        self._pending_notifications = []
        self._subscribers = bbcollections.defaultdict(set)

        self._pending_operation_count = 0

        self._started = False
Exemple #10
0
    def __init__(self, spec):
        # self._query_times = collections.deque()
        self._spec = spec

        # this is for synchronous calls: runQueryNow, runInteractionNow
        self._dbapi = spec.get_dbapi()
        self._nonpool = None
        self._nonpool_lastused = None
        self._nonpool_max_idle = spec.get_maxidle()

        self._change_cache = util.LRUCache()
        self._sourcestamp_cache = util.LRUCache()
        self._active_operations = set()  # protected by synchronized=
        self._pending_notifications = []
        self._subscribers = bbcollections.defaultdict(set)

        self._pending_operation_count = 0

        self._started = False
Exemple #11
0
 def _process_changes(self, t):
     db = self.parent.db
     res = db.scheduler_get_classified_changes(self.schedulerid, t)
     (important, unimportant) = res
     def _twolists(): return [], [] # important, unimportant
     branch_changes = collections.defaultdict(_twolists)
     for c in important:
         branch_changes[c.branch][0].append(c)
     for c in unimportant:
         branch_changes[c.branch][1].append(c)
     delays = []
     for branch in branch_changes:
         (b_important, b_unimportant) = branch_changes[branch]
         delay = self.decide_and_remove_changes(t, b_important,
                                                b_unimportant)
         if delay is not None:
             delays.append(delay)
     if delays:
         return min(delays)
     return None
Exemple #12
0
 def _process_changes(self, t):
     db = self.parent.db
     res = db.scheduler_get_classified_changes(self.schedulerid, t)
     (important, unimportant) = res
     def _twolists(): return [], [] # important, unimportant
     branch_changes = collections.defaultdict(_twolists)
     for c in important:
         branch_changes[c.branch][0].append(c)
     for c in unimportant:
         branch_changes[c.branch][1].append(c)
     delays = []
     for branch in branch_changes:
         (b_important, b_unimportant) = branch_changes[branch]
         delay = self.decide_and_remove_changes(t, b_important,
                                                b_unimportant)
         if delay is not None:
             delays.append(delay)
     if delays:
         return min(delays)
     return None
Exemple #13
0
    def __init__(self, name, shouldntBeSet=NotSet, treeStableTimer=None,
                builderNames=None, branch=NotABranch, branches=NotABranch,
                fileIsImportant=None, properties={}, categories=None,
                change_filter=None):
        assert shouldntBeSet is self.NotSet, \
                "pass arguments to schedulers using keyword arguments"
        if fileIsImportant:
            assert callable(fileIsImportant)

        # initialize parent classes
        base.BaseScheduler.__init__(self, name, builderNames, properties)

        self.treeStableTimer = treeStableTimer
        self.fileIsImportant = fileIsImportant
        self.change_filter = self.getChangeFilter(branch=branch,
                branches=branches, change_filter=change_filter,
                categories=categories)

        # the IDelayedCall used to wake up when this scheduler's
        # treeStableTimer expires.
        self._stable_timers = collections.defaultdict(lambda : None)
        self._stable_timers_lock = defer.DeferredLock()
 def setUp(self):
     self.dd = collections.defaultdict(list)
Exemple #15
0
 def setUp(self):
     self.dd = collections.defaultdict(list)
Exemple #16
0
 def __init__(self, master, db, change_svc):
     loop.MultiServiceLoop.__init__(self)
     self.master = master
     self.db = db
     self.change_svc = change_svc
     self.upstream_subscribers = collections.defaultdict(list)
Exemple #17
0
 def __init__(self, master, db, change_svc):
     loop.MultiServiceLoop.__init__(self)
     self.master = master
     self.db = db
     self.change_svc = change_svc
     self.upstream_subscribers = collections.defaultdict(list)
Exemple #18
0
 def __init__(self, master):
     service.MultiService.__init__(self)
     self.master = master
     self.upstream_subscribers = collections.defaultdict(list)
     self._updateLock = defer.DeferredLock()
Exemple #19
0
 def __init__(self, master):
     service.MultiService.__init__(self)
     self.master = master
     self.upstream_subscribers = collections.defaultdict(list)
     self._updateLock = defer.DeferredLock()