Message232731
| Author |
polymorphm |
| Recipients |
berker.peksag, demian.brecht, flox, loewis, mcjeff, polymorphm |
| Date |
2014年12月16日.09:56:55 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1418723815.57.0.225987055115.issue14134@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
@demian.brecht , for high probably to catch *infinite_freeze* (at GNU/Linux) -- if we may will run requests of "xmlrpc.client.ServerProxy" -- parallely:
(when running next code -- need to make some network-disconnections on "network-router-computer")
#!/usr/bin/env python3
import threading
from xmlrpc.client import ServerProxy
ITERATION_COUNT = 100
THREAD_COUNT = 100
def thread_func(thread_name):
for i in range(ITERATION_COUNT):
try:
server = ServerProxy("http://betty.userland.com")
rpc_result = server.examples.getStateName(41)
print('{}/iter_{} {!r}'.format(thread_name, i, rpc_result))
except Exception as e:
print('{}/iter_{} error: {} {}'.format(thread_name, i, type(e), str(e)))
def main():
print('***** testing begin *****')
thread_list = []
for i in range(THREAD_COUNT):
thread_name = 'thread_{}'.format(i)
thread_list.append(threading.Thread(target=thread_func, args=(thread_name,)))
for thr in thread_list:
thr.start()
for thr in thread_list:
thr.join()
print('***** testing end *****')
if __name__ == '__main__':
main() |
|