[pypy-svn] r37975 - in pypy/dist/pypy/tool/build: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Feb 5 17:32:57 CET 2007
Author: cfbolz
Date: Mon Feb 5 17:32:57 2007
New Revision: 37975
Modified:
pypy/dist/pypy/tool/build/buildserver.py
pypy/dist/pypy/tool/build/metaserver.py
pypy/dist/pypy/tool/build/test/fake.py
pypy/dist/pypy/tool/build/test/test_buildserver.py
pypy/dist/pypy/tool/build/test/test_metaserver.py
Log:
tell the requesting client on which server his request is being built
Modified: pypy/dist/pypy/tool/build/buildserver.py
==============================================================================
--- pypy/dist/pypy/tool/build/buildserver.py (original)
+++ pypy/dist/pypy/tool/build/buildserver.py Mon Feb 5 17:32:57 2007
@@ -5,7 +5,8 @@
from pypy.tool.build import build
class BuildServer(object):
- def __init__(self, channel, sysinfo, testing_sleeptime=False):
+ def __init__(self, channel, sysinfo, hostname, testing_sleeptime=False):
+ self.hostname = hostname
self.channel = channel
self.sysinfo = sysinfo
self.busy_on = None
@@ -72,7 +73,7 @@
try:
try:
- bs = BuildServer(channel, %r, %r)
+ bs = BuildServer(channel, %r, %r, %r)
bs.sit_and_wait()
except:
try:
@@ -97,6 +98,7 @@
sysinfo = make_dict(sysconfig)
conference = execnetconference.conference(gw, port, False)
channel = conference.remote_exec(initcode % (path, sysinfo,
+ py.std.socket.gethostname(),
testing_sleeptime))
return channel
Modified: pypy/dist/pypy/tool/build/metaserver.py
==============================================================================
--- pypy/dist/pypy/tool/build/metaserver.py (original)
+++ pypy/dist/pypy/tool/build/metaserver.py Mon Feb 5 17:32:57 2007
@@ -26,7 +26,7 @@
return True
class MetaServer(object):
- """ the build server
+ """ the build meta-server
this delegates or queues build requests, and stores results and sends
out emails when they're done
@@ -88,13 +88,17 @@
return (True, path)
for builder in self._builders:
if builder.busy_on and request.has_satisfying_data(builder.busy_on):
- self._channel.send('build for %s currently in progress' %
- (request,))
+ self._channel.send(
+ "build for %s currently in progress on '%s'" % (
+ request, builder.hostname))
self._waiting.append(request)
- return (False, 'this build is already in progress')
+ return (False, "this build is already in progress on '%s'" % (
+ builder.hostname, ))
# we don't have a build for this yet, find a builder to compile it
- if self.run(request):
- return (False, 'found a suitable build server, going to build')
+ hostname = self.run(request)
+ if hostname is not None:
+ return (False, "found a suitable server, going to build on '%s'" %
+ (hostname, ))
self._queuelock.acquire()
try:
self._queued.append(request)
@@ -117,13 +121,13 @@
else:
self._channel.send(
'going to send compile job for request %s to %s' % (
- request, builder
+ request, builder.hostname
)
)
accepted = builder.compile(request)
if accepted:
self._channel.send('compile job accepted')
- return True
+ return builder.hostname
else:
self._channel.send('compile job denied')
self._channel.send(
Modified: pypy/dist/pypy/tool/build/test/fake.py
==============================================================================
--- pypy/dist/pypy/tool/build/test/fake.py (original)
+++ pypy/dist/pypy/tool/build/test/fake.py Mon Feb 5 17:32:57 2007
@@ -22,6 +22,7 @@
self.sysinfo = info
self.busy_on = None
self.refused = []
+ self.hostname = "fake"
def compile(self, request):
self.channel.send(request.serialize())
Modified: pypy/dist/pypy/tool/build/test/test_buildserver.py
==============================================================================
--- pypy/dist/pypy/tool/build/test/test_buildserver.py (original)
+++ pypy/dist/pypy/tool/build/test/test_buildserver.py Mon Feb 5 17:32:57 2007
@@ -24,11 +24,11 @@
pypy.tool.build.metaserver_instance = svr
mod.c1c = c1c = FakeChannel()
- mod.c1 = c1 = BuildServerForTests(c1c, {'foo': 1, 'bar': [1,2]})
+ mod.c1 = c1 = BuildServerForTests(c1c, {'foo': 1, 'bar': [1,2]}, "noname")
svr.register(c1)
mod.c2c = c2c = FakeChannel()
- mod.c2 = c2 = BuildServerForTests(c2c, {'foo': 2, 'bar': [2,3]})
+ mod.c2 = c2 = BuildServerForTests(c2c, {'foo': 2, 'bar': [2,3]}, "noname")
svr.register(c2)
def test_compile():
Modified: pypy/dist/pypy/tool/build/test/test_metaserver.py
==============================================================================
--- pypy/dist/pypy/tool/build/test/test_metaserver.py (original)
+++ pypy/dist/pypy/tool/build/test/test_metaserver.py Mon Feb 5 17:32:57 2007
@@ -52,7 +52,8 @@
str(repodir), 'HEAD', 0)
ret = svr.compile(br)
assert not ret[0]
- assert ret[1].find('found a suitable build server') > -1
+ assert ret[1].find('found a suitable server') > -1
+ assert "fake" in ret[1] # hostname
ret = svr._channel.receive()
assert ret.find('going to send compile job') > -1
acceptedmsg = svr._channel.receive()
More information about the Pypy-commit
mailing list