Ticket #296: notifySchedulers.diff

File notifySchedulers.diff, 2.9 kB (added by bhearsum, 6 months ago)

[v3] scheduler notification for buildsets

  • a/buildbot/buildset.py

    old new  
    3131    def waitUntilFinished(self): 
    3232        return self.status.waitUntilFinished() 
    3333 
    34     def start(self, builders): 
     34    def start(self, builders, notifyScheduler=None): 
    3535        """This is called by the BuildMaster to actually create and submit 
    3636        the BuildRequests.""" 
    3737        self.requests = [] 
     
    4545            self.requests.append(req) 
    4646            d = req.waitUntilFinished() 
    4747            d.addCallback(self.requestFinished, req) 
     48            if notifyScheduler: 
     49                req.subscribe(notifyScheduler.buildStarted) 
     50                d.addCallback(notifyScheduler.buildFinished, req) 
    4851 
    4952        # tell our status about them 
    5053        req_statuses = [req.status for req in self.requests] 
  • a/buildbot/interfaces.py

    old new  
    967967        themselves whether the change is interesting or not, and may initiate 
    968968        a build as a result.""" 
    969969 
    970     def submitBuildSet(buildset): 
     970    def submitBuildSet(buildset, notifyScheduler): 
    971971        """Submit a BuildSet object, which will eventually be run on all of 
    972972        the builders listed therein.""" 
    973973 
  • a/buildbot/master.py

    old new  
    870870        for s in self.allSchedulers(): 
    871871            s.addChange(change) 
    872872 
    873     def submitBuildSet(self, bs): 
     873    def submitBuildSet(self, bs, notifyScheduler=None): 
    874874        # determine the set of Builders to use 
    875875        builders = [] 
    876876        for name in bs.builderNames: 
     
    884884 
    885885        # now tell the BuildSet to create BuildRequests for all those 
    886886        # Builders and submit them 
    887         bs.start(builders
     887        bs.start(builders, notifyScheduler
    888888        self.status.buildsetSubmitted(bs.status) 
    889889 
    890890 
     
    897897    def addChange(self, change): 
    898898        self.master.change_svc.addChange(change) 
    899899 
    900     def submitBuildSet(self, bs): 
    901         self.master.submitBuildSet(bs
     900    def submitBuildSet(self, bs, notifyScheduler): 
     901        self.master.submitBuildSet(bs, notifyScheduler
    902902 
    903903    def getBuilder(self, name): 
    904904        b = self.master.botmaster.builders[name] 
  • a/buildbot/test/test_scheduler.py

    old new  
    1414 
    1515class FakeMaster(service.MultiService): 
    1616    d = None 
    17     def submitBuildSet(self, bs): 
     17    def submitBuildSet(self, bs, notifyScheduler): 
    1818        self.sets.append(bs) 
    1919        if self.d: 
    2020            reactor.callLater(0, self.d.callback, bs)