changeset 49:b4c51e32952b

Build slave now also handles snapshot archives in bzip2 and zip format.
author cmlenz
date Fri, 24 Jun 2005 17:26:47 +0000
parents 757aa3bf9594
children 0d5ad32948b7
files bitten/master.py bitten/slave.py bitten/util/beep.py
diffstat 3 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/master.py
+++ b/bitten/master.py
@@ -84,10 +84,10 @@
     def _check_build_queue(self, master, when):
         if not self.slaves:
             return
-        logging.info('Checking for pending builds...')
+        logging.debug('Checking for pending builds...')
         for build in Build.select(self.env, status=Build.PENDING):
-            logging.info('Building configuration "%s" as of revision [%s]',
-                         build.config, build.rev)
+            logging.debug('Building configuration "%s" as of revision [%s]',
+                          build.config, build.rev)
             snapshot = self.snapshots[(build.config, build.rev)]
             for slave in self.slaves.values():
                 active_builds = Build.select(self.env, slave=slave.name,
@@ -146,7 +146,7 @@
                          self.name, platform, os, os_version, os_family)
 
     def send_build(self, build, snapshot_path, handle_reply=None):
-        logging.info('Initiating build on slave %s', self.name)
+        logging.debug('Initiating build on slave %s', self.name)
         self.building = True
 
         def handle_reply(cmd, msgno, msg):
@@ -160,7 +160,8 @@
             build.time = int(time.time())
             build.status = Build.IN_PROGRESS
             build.update()
-            logging.info('Build started')
+            logging.info('Slave %s started build of "%s" at [%s]', self.name,
+                         build.config, build.rev)
 
         # TODO: should not block while reading the file; rather stream it using
         #       asyncore push_with_producer()
--- a/bitten/slave.py
+++ b/bitten/slave.py
@@ -65,9 +65,22 @@
         self.channel.send_msg(beep.MIMEMessage(xml), handle_reply)
 
     def handle_msg(self, msgno, msg):
-        if msg.get_content_type() == 'application/tar':
+        content_type = msg.get_content_type()
+        if content_type in ('application/tar', 'application/zip'):
             workdir = tempfile.mkdtemp(prefix='bitten')
-            archive_name = msg.get('Content-Disposition', 'snapshot.tar.gz')
+
+            archive_name = msg.get('Content-Disposition')
+            if not archive_name:
+                if content_type == 'application/tar':
+                    encoding = msg.get('Content-Transfer-Encoding')
+                    if encoding == 'gzip':
+                        archive_name = 'snapshot.tar.gz'
+                    elif encoding == 'bzip2':
+                        archive_name = 'snapshot.tar.bz2'
+                    else:
+                        archive_name = 'snapshot.tar'
+                else:
+                    archive_name = 'snapshot.zip'
             archive_path = os.path.join(workdir, archive_name)
             file(archive_path, 'wb').write(msg.get_payload())
             logging.debug('Received snapshot archive: %s', archive_path)
--- a/bitten/util/beep.py
+++ b/bitten/util/beep.py
@@ -136,7 +136,7 @@
                     self.close()
             def handle_error(channelno, code, message):
                 logging.error('Failed to close channel %d', channelno)
-            logging.info('Should close session with %s', session.addr)
+            logging.debug('Closing session with %s', session.addr)
             session.terminate(handle_ok=handle_ok)
         self.schedule(0, terminate_next_session)
         self.run(.5)
Copyright (C) 2012-2017 Edgewall Software