diff options
Diffstat (limited to 'module/remote/thriftbackend/ThriftTest.py')
-rw-r--r-- | module/remote/thriftbackend/ThriftTest.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/module/remote/thriftbackend/ThriftTest.py b/module/remote/thriftbackend/ThriftTest.py index 7fe790cd9..587ca184a 100644 --- a/module/remote/thriftbackend/ThriftTest.py +++ b/module/remote/thriftbackend/ThriftTest.py @@ -9,9 +9,9 @@ sys.path.append(path) from thriftgen.pyload import Pyload from thriftgen.pyload.ttypes import * +from Socket import Socket from thrift import Thrift -from thrift.transport import TSocket from thrift.transport import TTransport from Protocol import Protocol @@ -47,42 +47,42 @@ bench(proxy.get_collector) print try: - # Make socket - transport = TSocket.TSocket('localhost', 7228) + # Make socket + transport = Socket('localhost', 7228) - # Buffering is critical. Raw sockets are very slow - transport = TTransport.TBufferedTransport(transport) + # Buffering is critical. Raw sockets are very slow + transport = TTransport.TBufferedTransport(transport) - # Wrap in a protocol - protocol = Protocol(transport) + # Wrap in a protocol + protocol = Protocol(transport) - # Create a client to use the protocol encoder - client = Pyload.Client(protocol) + # Create a client to use the protocol encoder + client = Pyload.Client(protocol) - # Connect! - transport.open() - - print "Login", client.login("User", "pyloadweb") - - bench(client.getServerVersion) - bench(client.statusServer) - bench(client.statusDownloads) - bench(client.getQueue) - bench(client.getCollector) + # Connect! + transport.open() - print - print client.getServerVersion() - print client.statusServer() - print client.statusDownloads() - q = client.getQueue() + print "Login", client.login("User", "pyloadweb") - for p in q: + bench(client.getServerVersion) + bench(client.statusServer) + bench(client.statusDownloads) + bench(client.getQueue) + bench(client.getCollector) + + print + print client.getServerVersion() + print client.statusServer() + print client.statusDownloads() + q = client.getQueue() + + for p in q: data = client.getPackageData(p.pid) print data print "Package Name: ", data.name - # Close! - transport.close() - + # Close! + transport.close() + except Thrift.TException, tx: - print 'ThriftExpection: %s' % (tx.message) + print 'ThriftExpection: %s' % (tx.message) |