[Checkins] SVN: gocept.zeoraid/branches/dirceu-distributed-write-calls/src/gocept/zeoraid/storage.py Trying another approach to parallelize __apply_all_storages

Dirceu Pereira Tiegs dirceutiegs at gmail.com
Fri Jul 11 06:38:04 EDT 2008


Log message for revision 88247:
  Trying another approach to parallelize __apply_all_storages

Changed:
  U   gocept.zeoraid/branches/dirceu-distributed-write-calls/src/gocept/zeoraid/storage.py

-=-
Modified: gocept.zeoraid/branches/dirceu-distributed-write-calls/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/branches/dirceu-distributed-write-calls/src/gocept/zeoraid/storage.py	2008-07-11 07:42:28 UTC (rev 88246)
+++ gocept.zeoraid/branches/dirceu-distributed-write-calls/src/gocept/zeoraid/storage.py	2008-07-11 10:38:01 UTC (rev 88247)
@@ -638,9 +638,21 @@
         N-th storage.
 
         """
-        def _remote_apply_storage():
-            self.reliable, self.result = self.__apply_storage(
-                    name, method_name, args, kw, expect_connected)
+        class ThreadedApplyStorage(threading.Thread):
+            def __init__(self, name, method_name, args, kw, expect_connected, __apply_storage):
+                threading.Thread.__init__(self)
+                self.name = name
+                self.method_name = method_name
+                self.args = args
+                self.kw = kw
+                self.expect_connected = expect_connected
+                self.reliable = None
+                self.result = None
+                self.__apply_storage = __apply_storage
+            def run(self):
+                self.reliable, self.result = self.__apply_storage(
+                        self.name, self.method_name, self.args, 
+                        self.kw, self.expect_connected)
 
         results = []
         exceptions = []
@@ -662,7 +674,7 @@
         for name in applicable_storages:
             try:
                 args = argument_iterable.next()
-                t = threading.Thread(target=_remote_apply_storage)
+                t = ThreadedApplyStorage(name, method_name, args, kw, expect_connected, self.__apply_storage)
                 t.start()
                 t.join(60)
                 reliable, result = t.reliable, t.result



More information about the Checkins mailing list