[Zodb-checkins] CVS: Packages/ZEO - multi.py:1.3
jeremy@digicool.com
jeremy@digicool.com
Tue, 8 May 2001 17:27:08 -0400 (EDT)
Update of /cvs-repository/Packages/ZEO/tests
In directory korak:/tmp/cvs-serv16031/tests
Modified Files:
multi.py
Log Message:
Add new features from ZEO2.
Support for using basic multi framework with other run() functions.
--- Updated File multi.py in package Packages/ZEO --
--- multi.py 2001/05/01 19:50:42 1.2
+++ multi.py 2001/05/08 21:27:08 1.3
@@ -53,14 +53,17 @@
pid, exit = forker.start_zeo_server(storage, addr)
return pid, exit
-def start_client(addr):
+def start_client(addr, client_func=None):
pid = os.fork()
if pid == 0:
import ZEO.ClientStorage
if VERBOSE:
print "Client process started:", os.getpid()
cli = ZEO.ClientStorage.ClientStorage(addr, client=CLIENT_CACHE)
- run(cli)
+ if client_func is None:
+ run(cli)
+ else:
+ client_func(cli)
cli.close()
os._exit(0)
else:
@@ -105,21 +108,15 @@
get_transaction().commit()
print "Client completed:", pid
-
-def shutdown_server(addr):
- import ZEO.ClientStorage
- # XXX this doesn't work!
- cli = ZEO.ClientStorage.ClientStorage(addr)
- cli._server.rpc.callAsync('shutdown')
-def main():
+def main(client_func=None):
if VERBOSE:
print "Main process:", os.getpid()
addr = tempfile.mktemp()
t0 = time.time()
server_pid, server = start_server(addr)
t1 = time.time()
- pids = [start_client(addr) for i in range(CLIENTS)]
+ pids = [start_client(addr, client_func) for i in range(CLIENTS)]
for pid in pids:
assert type(pid) == types.IntType, "invalid pid type: %s (%s)" % \
(repr(pid), type(pid))