[Buildbot-commits] buildbot/buildbot buildset.py, 1.8, 1.9 buildslave.py, 1.10, 1.11 scheduler.py, 1.30, 1.31

Brian Warner warner at users.sourceforge.net
Thu May 22 22:13:08 UTC 2008


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17543/buildbot

Modified Files:
	buildset.py buildslave.py scheduler.py 
Log Message:
[project @ #124:scheduler-properties.patch]
Arrange for properties to come down from schedulers, via BuildStep and
BuildRequest objects.  custom_props are still present, in parallel, but
will go eventually. Triggered builds no longer propagate custom props.

Original author: dustin at v.igoro.us
Date: 2008-04-12 23:46:58+00:00

Index: buildset.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/buildset.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- buildset.py	22 May 2008 22:12:14 -0000	1.8
+++ buildset.py	22 May 2008 22:13:06 -0000	1.9
@@ -11,7 +11,7 @@
     (source.changes=list)."""
 
     def __init__(self, builderNames, source, reason=None, bsid=None,
-                 scheduler=None, custom_props=None):
+                 custom_props=None, properties=None):
         """
         @param source: a L{buildbot.sourcestamp.SourceStamp}
         """
@@ -19,13 +19,12 @@
         self.source = source
         self.reason = reason
 
-        if not custom_props: custom_props = {}
         self.custom_props = custom_props
+        self.properties = properties
 
         self.stillHopeful = True
         self.status = bss = builder.BuildSetStatus(source, reason,
                                                    builderNames, bsid)
-	self.scheduler = scheduler
 
     def waitUntilSuccess(self):
         return self.status.waitUntilSuccess()
@@ -41,8 +40,8 @@
         # create the requests
         for b in builders:
             req = base.BuildRequest(self.reason, self.source, b.name, 
-                                    scheduler=self.scheduler,
-                                    custom_props=self.custom_props)
+                                    custom_props=self.custom_props,
+                                    properties=self.properties)
             reqs.append((b, req))
             self.requests.append(req)
             d = req.waitUntilFinished()

Index: buildslave.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/buildslave.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- buildslave.py	18 Mar 2008 21:41:15 -0000	1.10
+++ buildslave.py	22 May 2008 22:13:06 -0000	1.11
@@ -11,6 +11,7 @@
 from buildbot.status.builder import SlaveStatus
 from buildbot.status.mail import MailNotifier
 from buildbot.interfaces import IBuildSlave
+from buildbot.process.properties import Properties
 
 class BuildSlave(NewCredPerspective, service.MultiService):
     """This is the master-side representative for a remote buildbot slave.
@@ -26,7 +27,8 @@
     implements(IBuildSlave)
 
     def __init__(self, name, password, max_builds=None,
-                 notify_on_missing=[], missing_timeout=3600):
+                 notify_on_missing=[], missing_timeout=3600,
+                 properties={}):
         """
         @param name: botname this machine will supply when it connects
         @param password: password this machine will supply when
@@ -34,6 +36,9 @@
         @param max_builds: maximum number of simultaneous builds that will
                            be run concurrently on this buildslave (the
                            default is None for no limit)
+        @param properties: properties that will be applied to builds run on 
+                           this slave
+        @type properties: dictionary
         """
         service.MultiService.__init__(self)
         self.slavename = name
@@ -44,6 +49,11 @@
         self.slave_commands = None
         self.slavebuilders = []
         self.max_builds = max_builds
+
+        self.properties = Properties()
+        self.properties.update(properties, "BuildSlave")
+        self.properties.setProperty("slavename", name, "BuildSlave")
+
         self.lastMessageReceived = 0
         if isinstance(notify_on_missing, str):
             notify_on_missing = [notify_on_missing]

Index: scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scheduler.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- scheduler.py	22 May 2008 22:12:05 -0000	1.30
+++ scheduler.py	22 May 2008 22:13:06 -0000	1.31
@@ -14,14 +14,33 @@
 from buildbot.status import builder
 from buildbot.sourcestamp import SourceStamp
 from buildbot.changes.maildir import MaildirService
+from buildbot.process.properties import Properties
 
 
 class BaseScheduler(service.MultiService, util.ComparableMixin):
+    """
+    A Schduler creates BuildSets and submits them to the BuildMaster.
+
+    @ivar name: name of the scheduler
+
+    @ivar properties: additional properties specified in this 
+        scheduler's configuration
+    @type properties: Properties object
+    """
     implements(interfaces.IScheduler)
 
-    def __init__(self, name):
+    def __init__(self, name, properties={}):
+        """
+        @param name: name for this scheduler
+
+        @param properties: properties to be propagated from this scheduler
+        @type properties: dict
+        """
         service.MultiService.__init__(self)
         self.name = name
+        self.properties = Properties()
+        self.properties.update(properties, "Scheduler")
+        self.properties.setProperty("scheduler", name, "Scheduler")
 
     def __repr__(self):
         # TODO: why can't id() return a positive number? %d is ugly.
@@ -170,8 +189,7 @@
 
         # create a BuildSet, submit it to the BuildMaster
         bs = buildset.BuildSet(self.builderNames,
-                               SourceStamp(changes=changes),
-                               scheduler=self)
+                               SourceStamp(changes=changes))
         self.submit(bs)
 
     def stopService(self):
@@ -305,7 +323,7 @@
         return d
 
     def upstreamBuilt(self, ss):
-        bs = buildset.BuildSet(self.builderNames, ss, scheduler=self)
+        bs = buildset.BuildSet(self.builderNames, ss)
         self.submit(bs)
 
 
@@ -344,7 +362,7 @@
     def doPeriodicBuild(self):
         bs = buildset.BuildSet(self.builderNames,
                                SourceStamp(branch=self.branch),
-                               self.reason, scheduler=self)
+                               self.reason)
         self.submit(bs)
 
 
@@ -502,7 +520,7 @@
         # And trigger a build
         bs = buildset.BuildSet(self.builderNames,
                                SourceStamp(branch=self.branch),
-                               self.reason, scheduler=self)
+                               self.reason)
         self.submit(bs)
 
     def addChange(self, change):
@@ -624,7 +642,7 @@
                 return
 
         reason = "'try' job"
-        bs = buildset.BuildSet(builderNames, ss, reason=reason, bsid=bsid, scheduler=self)
+        bs = buildset.BuildSet(builderNames, ss, reason=reason, bsid=bsid)
         self.parent.submitBuildSet(bs)
 
 class Try_Userpass(TryBase):
@@ -681,7 +699,6 @@
         bs = buildset.BuildSet(builderNames, 
                                ss,
                                reason=reason, 
-                               scheduler=self,
                                custom_props=custom_props)
 
         self.parent.submitBuildSet(bs)
@@ -710,7 +727,7 @@
         """Trigger this scheduler. Returns a deferred that will fire when the
         buildset is finished.
         """
-        bs = buildset.BuildSet(self.builderNames, ss, scheduler=self, custom_props=custom_props)
+        bs = buildset.BuildSet(self.builderNames, ss, custom_props=custom_props)
         d = bs.waitUntilFinished()
         self.submit(bs)
         return d





More information about the Commits mailing list