blob: 8b7c3e3f58da755b1e751e44f7f101fde66e0404 [file] [log] [blame]
David Reiss5ddabb82010-10-06 17:09:37 +00001#!/usr/bin/env python
2import sys
3import time
4from thrift.transport import TTransport
5from thrift.transport import TSocket
6from thrift.protocol import TBinaryProtocol
7from thrift.server import THttpServer
8from aggr import Aggr
9
10class AggrHandler(Aggr.Iface):
11 def __init__(self):
12 self.values = []
13
14 def addValue(self, value):
15 self.values.append(value)
16
17 def getValues(self, ):
18 time.sleep(1)
19 return self.values
20
21processor = Aggr.Processor(AggrHandler())
22pfactory = TBinaryProtocol.TBinaryProtocolFactory()
23THttpServer.THttpServer(processor, ('', int(sys.argv[1])), pfactory).serve()