<s> import os <EOL> import sys <EOL> from time import strftime , gmtime <EOL> import logging <EOL> from optparse import OptionParser <EOL> from twisted . internet import reactor <EOL> from twisted . internet import task <EOL> for path in [ <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:..>' , '<STR_LIT>' ) ) <EOL> ] : <EOL> if os . path . exists ( os . path . join ( path , '<STR_LIT>' ) ) : <EOL> sys . path . insert ( <NUM_LIT:0> , path ) <EOL> break <EOL> from txzmq import ZmqFactory <EOL> import data_manager <EOL> import zmq_requestor <EOL> from util import Identity <EOL> import constants <EOL> import qasino_table <EOL> def send_dummy_table ( zmq_requestor , schema_version ) : <EOL> table = qasino_table . QasinoTable ( options . tablename ) <EOL> if int ( schema_version ) == <NUM_LIT:0> : <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT:int>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT:int>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> table . add_row ( [ Identity . get_identity ( ) , <NUM_LIT> , <NUM_LIT:5> , "<STR_LIT:yes>" , "<STR_LIT>" ] ) <EOL> table . add_row ( [ Identity . get_identity ( ) , <NUM_LIT:1000> , <NUM_LIT> , "<STR_LIT>" , strftime ( "<STR_LIT>" , gmtime ( ) ) ] ) <EOL> else : <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT:int>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT:int>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> table . add_column ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> table . add_column ( "<STR_LIT:foo>" , "<STR_LIT>" ) <EOL> table . add_row ( [ Identity . get_identity ( ) , <NUM_LIT> , <NUM_LIT:5> , "<STR_LIT:yes>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> table . add_row ( [ Identity . get_identity ( ) , <NUM_LIT:1000> , <NUM_LIT> , "<STR_LIT>" , strftime ( "<STR_LIT>" , gmtime ( ) ) , "<STR_LIT>" ] ) <EOL> if options . persist : <EOL> table . set_property ( "<STR_LIT>" , <NUM_LIT:1> ) <EOL> if options . static : <EOL> table . set_property ( "<STR_LIT>" , <NUM_LIT:1> ) <EOL> zmq_requestor . send_table ( table ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> parser = OptionParser ( ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" , metavar = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = <NUM_LIT:0> , <EOL> help = "<STR_LIT>" , metavar = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = <NUM_LIT:0> , <EOL> help = "<STR_LIT>" , metavar = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = "<STR_LIT>" , <EOL> help = "<STR_LIT>" , metavar = "<STR_LIT>" ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> if options . identity != None : <EOL> Identity . set_identity ( options . identity ) <EOL> logging . basicConfig ( format = "<STR_LIT>" , datefmt = "<STR_LIT>" , <EOL> level = logging . INFO ) <EOL> logging . info ( "<STR_LIT>" , constants . ZMQ_RPC_PORT ) <EOL> zmq_factory = ZmqFactory ( ) <EOL> zmq_requestor = zmq_requestor . ZmqRequestor ( options . hostname , constants . ZMQ_RPC_PORT , zmq_factory ) <EOL> task = task . LoopingCall ( send_dummy_table , zmq_requestor , options . schema_version ) <EOL> task . start ( <NUM_LIT> ) <EOL> reactor . run ( ) </s>
