Mercurial > bitten > bitten-test
annotate bitten/slave.py @ 61:47ab019508dd
Moved {{{BuildError}}} class into package {{{bitten.build}}}.
author | cmlenz |
---|---|
date | Tue, 28 Jun 2005 10:47:07 +0000 |
parents | 055a6c666fa8 |
children | 2332aedba328 |
rev | line source |
---|---|
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
1 # -*- coding: iso8859-1 -*- |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
2 # |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
3 # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de> |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
4 # |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
5 # Bitten is free software; you can redistribute it and/or |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
6 # modify it under the terms of the GNU General Public License as |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
7 # published by the Free Software Foundation; either version 2 of the |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
8 # License, or (at your option) any later version. |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
9 # |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
10 # Trac is distributed in the hope that it will be useful, |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
13 # General Public License for more details. |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
14 # |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
15 # You should have received a copy of the GNU General Public License |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
16 # along with this program; if not, write to the Free Software |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
18 # |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
19 # Author: Christopher Lenz <cmlenz@gmx.de> |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
20 |
15
06207499c58c
* Use logging in the BEEP core as well as in the master and slave scripts. Closes #4.
cmlenz
parents:
14
diff
changeset
|
21 import logging |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
22 import os |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
23 import sys |
42
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
24 import tempfile |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
25 import time |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
26 |
61
47ab019508dd
Moved {{{BuildError}}} class into package {{{bitten.build}}}.
cmlenz
parents:
60
diff
changeset
|
27 from bitten.build import BuildError |
56 | 28 from bitten.recipe import Recipe |
48 | 29 from bitten.util import archive, beep, xmlio |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
30 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
31 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
32 class Slave(beep.Initiator): |
51
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
33 """Build slave.""" |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
34 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
35 def greeting_received(self, profiles): |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
36 if OrchestrationProfileHandler.URI not in profiles: |
47
083e848088ee
* Improvements to the model classes, and a couple of unit tests.
cmlenz
parents:
43
diff
changeset
|
37 err = 'Peer does not support the Bitten orchestration profile' |
083e848088ee
* Improvements to the model classes, and a couple of unit tests.
cmlenz
parents:
43
diff
changeset
|
38 logging.error(err) |
083e848088ee
* Improvements to the model classes, and a couple of unit tests.
cmlenz
parents:
43
diff
changeset
|
39 raise beep.TerminateSession, err |
29 | 40 self.channels[0].profile.send_start([OrchestrationProfileHandler]) |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
41 |
14
1733c601d2f8
Refactored the asyncore loop and shutdown procedure into {{{beep.Initiator}}}.
cmlenz
parents:
13
diff
changeset
|
42 |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
43 class OrchestrationProfileHandler(beep.ProfileHandler): |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
44 """Handler for communication on the Bitten build orchestration profile from |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
45 the perspective of the build slave. |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
46 """ |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
47 URI = 'http://bitten.cmlenz.net/beep/orchestration' |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
48 |
51
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
49 def handle_connect(self): |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
50 """Register with the build master.""" |
51
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
51 self.recipe_path = None |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
52 |
56 | 53 def handle_reply(cmd, msgno, ansno, msg): |
15
06207499c58c
* Use logging in the BEEP core as well as in the master and slave scripts. Closes #4.
cmlenz
parents:
14
diff
changeset
|
54 if cmd == 'ERR': |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
55 if msg.get_content_type() == beep.BEEP_XML: |
29 | 56 elem = xmlio.parse(msg.get_payload()) |
51
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
57 if elem.name == 'error': |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
58 raise beep.TerminateSession, '%s (%d)' \ |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
59 % (elem.gettext(), int(elem.attr['code'])) |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
60 raise beep.TerminateSession, 'Registration failed!' |
15
06207499c58c
* Use logging in the BEEP core as well as in the master and slave scripts. Closes #4.
cmlenz
parents:
14
diff
changeset
|
61 logging.info('Registration successful') |
29 | 62 |
63 sysname, nodename, release, version, machine = os.uname() | |
64 logging.info('Registering with build master as %s', nodename) | |
65 xml = xmlio.Element('register', name=nodename)[ | |
66 xmlio.Element('platform')[machine], | |
67 xmlio.Element('os', family=os.name, version=release)[sysname] | |
68 ] | |
69 self.channel.send_msg(beep.MIMEMessage(xml), handle_reply) | |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
70 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
71 def handle_msg(self, msgno, msg): |
49
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
72 content_type = msg.get_content_type() |
51
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
73 if content_type == beep.BEEP_XML: |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
74 elem = xmlio.parse(msg.get_payload()) |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
75 if elem.name == 'build': |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
76 # Received a build request |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
77 self.recipe_path = elem.attr['recipe'] |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
78 |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
79 xml = xmlio.Element('proceed')[ |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
80 xmlio.Element('accept', type='application/tar', |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
81 encoding='bzip2'), |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
82 xmlio.Element('accept', type='application/tar', |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
83 encoding='gzip'), |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
84 xmlio.Element('accept', type='application/zip') |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
85 ] |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
86 self.channel.send_rpy(msgno, beep.MIMEMessage(xml)) |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
87 |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
88 elif content_type in ('application/tar', 'application/zip'): |
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
89 # Received snapshot archive for build |
42
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
90 workdir = tempfile.mkdtemp(prefix='bitten') |
49
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
91 |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
92 archive_name = msg.get('Content-Disposition') |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
93 if not archive_name: |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
94 if content_type == 'application/tar': |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
95 encoding = msg.get('Content-Transfer-Encoding') |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
96 if encoding == 'gzip': |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
97 archive_name = 'snapshot.tar.gz' |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
98 elif encoding == 'bzip2': |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
99 archive_name = 'snapshot.tar.bz2' |
51
5caccd7b247e
Proper archive format negotiation; improved representation of parsed XML content in {{{bitten.util.xmlio}}}.
cmlenz
parents:
49
diff
changeset
|
100 elif not encoding: |
49
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
101 archive_name = 'snapshot.tar' |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
102 else: |
b4c51e32952b
Build slave now also handles snapshot archives in bzip2 and zip format.
cmlenz
parents:
48
diff
changeset
|
103 archive_name = 'snapshot.zip' |
42
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
104 archive_path = os.path.join(workdir, archive_name) |
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
105 file(archive_path, 'wb').write(msg.get_payload()) |
48 | 106 logging.debug('Received snapshot archive: %s', archive_path) |
42
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
107 |
48 | 108 # Unpack the archive |
109 prefix = archive.unpack(archive_path, workdir) | |
110 path = os.path.join(workdir, prefix) | |
57
ef78d71667ad
Added simple helper class for executing commandline programs.
cmlenz
parents:
56
diff
changeset
|
111 logging.debug('Unpacked snapshot to %s' % path) |
48 | 112 |
113 # Fix permissions | |
114 for root, dirs, files in os.walk(workdir, topdown=False): | |
115 for dirname in dirs: | |
116 os.chmod(os.path.join(root, dirname), 0700) | |
117 for filename in files: | |
118 os.chmod(os.path.join(root, filename), 0400) | |
42
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
119 |
56 | 120 self.execute_build(msgno, path, self.recipe_path) |
42
efa525876b1e
Basic infrastructure for transmission of snapshot archives to build slaves. See #8.
cmlenz
parents:
34
diff
changeset
|
121 |
56 | 122 def execute_build(self, msgno, basedir, recipe_path): |
123 logging.info('Building in directory %s using recipe %s', basedir, | |
124 recipe_path) | |
48 | 125 |
56 | 126 recipe = Recipe(recipe_path, basedir) |
127 | |
128 xml = xmlio.Element('started') | |
129 self.channel.send_ans(msgno, beep.MIMEMessage(xml)) | |
130 | |
131 for step in recipe: | |
132 logging.info('Executing build step "%s"', step.id) | |
133 try: | |
134 for function, args in step: | |
135 logging.debug('Executing command "%s"', function) | |
60
055a6c666fa8
* Pass a {{{Context}}} object to recipe commands as the first argument. Currently this only has the basedir, but will be extended to also provide output recording etc.
cmlenz
parents:
57
diff
changeset
|
136 function(recipe.ctxt, **args) |
56 | 137 xml = xmlio.Element('step', id=step.id, result='success', |
138 description=step.description) | |
139 self.channel.send_ans(msgno, beep.MIMEMessage(xml)) | |
140 except BuildError, e: | |
141 xml = xmlio.Element('step', id=step.id, result='failure', | |
142 description=step.description)[e] | |
143 self.channel.send_ans(msgno, beep.MIMEMessage(xml)) | |
144 | |
145 self.channel.send_nul(msgno) | |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
146 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
147 |
31 | 148 def main(): |
56 | 149 from bitten import __version__ as VERSION |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
150 from optparse import OptionParser |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
151 |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
152 parser = OptionParser(usage='usage: %prog [options] host [port]', |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
153 version='%%prog %s' % VERSION) |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
154 parser.add_option('--debug', action='store_const', dest='loglevel', |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
155 const=logging.DEBUG, help='enable debugging output') |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
156 parser.add_option('-v', '--verbose', action='store_const', dest='loglevel', |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
157 const=logging.INFO, help='print as much as possible') |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
158 parser.add_option('-q', '--quiet', action='store_const', dest='loglevel', |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
159 const=logging.ERROR, help='print as little as possible') |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
160 parser.set_defaults(loglevel=logging.WARNING) |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
161 options, args = parser.parse_args() |
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
162 |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
163 if len(args) < 1: |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
164 parser.error('incorrect number of arguments') |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
165 host = args[0] |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
166 if len(args) > 1: |
18
591a5a836ecc
* {{{beep.Listener}}} now has an event loop (based on code mostly from medusa)
cmlenz
parents:
15
diff
changeset
|
167 try: |
591a5a836ecc
* {{{beep.Listener}}} now has an event loop (based on code mostly from medusa)
cmlenz
parents:
15
diff
changeset
|
168 port = int(args[1]) |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
169 assert (1 <= port <= 65535), 'port number out of range' |
47
083e848088ee
* Improvements to the model classes, and a couple of unit tests.
cmlenz
parents:
43
diff
changeset
|
170 except (AssertionError, ValueError): |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
171 parser.error('port must be an integer in the range 1-65535') |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
172 else: |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
173 port = 7633 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
174 |
19
9db5f8eddb0d
Proper {{{optparse}}}-based command-line interface for master and slave.
cmlenz
parents:
18
diff
changeset
|
175 logging.getLogger().setLevel(options.loglevel) |
13
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
176 |
21aa17f97522
Initial code for build master and slave... these don't do a lot yet.
cmlenz
parents:
diff
changeset
|
177 slave = Slave(host, port) |
34
6da9468a6879
The build master now gracefully exits by first terminating all active sessions. Fixes #7.
cmlenz
parents:
33
diff
changeset
|
178 try: |
6da9468a6879
The build master now gracefully exits by first terminating all active sessions. Fixes #7.
cmlenz
parents:
33
diff
changeset
|
179 slave.run() |
6da9468a6879
The build master now gracefully exits by first terminating all active sessions. Fixes #7.
cmlenz
parents:
33
diff
changeset
|
180 except KeyboardInterrupt: |
6da9468a6879
The build master now gracefully exits by first terminating all active sessions. Fixes #7.
cmlenz
parents:
33
diff
changeset
|
181 slave.quit() |
31 | 182 |
183 if __name__ == '__main__': | |
33
d8d44216258a
Exit the slave script when the master disconnects; and other minor fixes.
cmlenz
parents:
31
diff
changeset
|
184 main() |