summaryrefslogtreecommitdiffstats
path: root/module/remote/ThriftTest.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-02-10 20:38:22 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-02-10 20:38:22 +0100
commit272d24bc521aa932128ed9ab9a6f20a70d572768 (patch)
tree1f8a9ec07c09cdcdad333ff650a68580d26ac897 /module/remote/ThriftTest.py
parentclosed #238 (diff)
downloadpyload-272d24bc521aa932128ed9ab9a6f20a70d572768.tar.xz
thriftbackend cleanup
Diffstat (limited to 'module/remote/ThriftTest.py')
-rw-r--r--module/remote/ThriftTest.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/module/remote/ThriftTest.py b/module/remote/ThriftTest.py
deleted file mode 100644
index fe24c1031..000000000
--- a/module/remote/ThriftTest.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-
-from thriftgen.pyload import Pyload
-from thriftgen.pyload.ttypes import *
-
-from thrift import Thrift
-from thrift.transport import TSocket
-from thrift.transport import TTransport
-from thrift.protocol import TBinaryProtocol
-
-from time import sleep, time
-
-import xmlrpclib
-
-def bench(f, *args, **kwargs):
- s = time()
- ret = f(*args, **kwargs)
- e = time()
- print "time", e-s
- return ret
-
-server_url = "http%s://%s:%s@%s:%s/" % (
- "",
- "user",
- "password",
- "127.0.0.1",
- 7227
-)
-proxy = xmlrpclib.ServerProxy(server_url, allow_none=True)
-
-bench(proxy.get_server_version)
-bench(proxy.get_queue)
-bench(proxy.get_collector)
-print
-try:
-
- # Make socket
- transport = TSocket.TSocket('localhost', 9090)
-
- # Buffering is critical. Raw sockets are very slow
- transport = TTransport.TBufferedTransport(transport)
-
- # Wrap in a protocol
- protocol = TBinaryProtocol.TBinaryProtocol(transport)
-
- # Create a client to use the protocol encoder
- client = Pyload.Client(protocol)
-
- # Connect!
- transport.open()
-
- client.login("user", "password")
-
- bench(client.getServerVersion)
- bench(client.getQueue)
- bench(client.getCollector)
-
- # Close!
- transport.close()
-
-except Thrift.TException, tx:
- print '%s' % (tx.message)