[pypy-svn] r35568 - in pypy/dist/pypy/tool/build: . test

guido at codespeak.net guido at codespeak.net
Mon Dec 11 13:46:31 CET 2006


Author: guido
Date: Mon Dec 11 13:46:29 2006
New Revision: 35568

Modified:
   pypy/dist/pypy/tool/build/client.py
   pypy/dist/pypy/tool/build/server.py
   pypy/dist/pypy/tool/build/test/fake.py
   pypy/dist/pypy/tool/build/test/test_client.py
Log:
Made that refusals (using the checker mechanism) are cached on client objects,
if an info set is refused once, the server will not ask the client to compile
it again.


Modified: pypy/dist/pypy/tool/build/client.py
==============================================================================
--- pypy/dist/pypy/tool/build/client.py	(original)
+++ pypy/dist/pypy/tool/build/client.py	Mon Dec 11 13:46:29 2006
@@ -8,6 +8,7 @@
         self.channel = channel
         self.sysinfo = sysinfo
         self.busy_on = None
+        self.refused = []
         self.testing = testing
 
         from pypy.tool.build import ppbserver
@@ -26,6 +27,8 @@
         accepted = self.channel.receive()
         if accepted:
             thread.start_new_thread(self.wait_until_done, (info,))
+        else:
+            self.refused.append(info)
         return accepted
 
     def wait_until_done(self, info):

Modified: pypy/dist/pypy/tool/build/server.py
==============================================================================
--- pypy/dist/pypy/tool/build/server.py	(original)
+++ pypy/dist/pypy/tool/build/server.py	Mon Dec 11 13:46:29 2006
@@ -203,7 +203,8 @@
         # XXX shuffle should be replaced by something smarter obviously ;)
         random.shuffle(clients)
         for client in clients:
-            if client.busy_on or not issubdict(info[0], client.sysinfo):
+            if (client.busy_on or not issubdict(info[0], client.sysinfo) or
+                    info in client.refused):
                 continue
             else:
                 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 Dec 11 13:46:29 2006
@@ -21,6 +21,7 @@
         self.channel = FakeChannel()
         self.sysinfo = info
         self.busy_on = None
+        self.refused = []
 
     def compile(self, info):
         for k, v in info[0].items():

Modified: pypy/dist/pypy/tool/build/test/test_client.py
==============================================================================
--- pypy/dist/pypy/tool/build/test/test_client.py	(original)
+++ pypy/dist/pypy/tool/build/test/test_client.py	Mon Dec 11 13:46:29 2006
@@ -66,4 +66,5 @@
     c1c.send(False) # notifying we _don't_ 'accept' the compile
     accepted = c1.compile(info)
     assert not accepted
+    assert info in c1.refused
 



More information about the Pypy-commit mailing list