示例#1
0
 def queue_request(self, hostname, port, request, exectime):
     dbhandler = DBHandler(self.server.settings)
     sql = "insert into pdu_queue (hostname,port,request,exectime) " \
           "values ('%s',%i,'%s',%i)" % (hostname, port, request, exectime)
     dbhandler.do_sql(sql)
     dbhandler.close()
     del dbhandler
示例#2
0
 def run_me(self):
     logging.info("Starting up the PDURunner")
     while 1:
         db = DBHandler(self.settings)
         self.get_one(db)
         db.close()
         del (db)
         time.sleep(2)
示例#3
0
    def __init__(self, settings):
        listen_host = settings["hostname"]
        listen_port = settings["port"]

        logging.getLogger().name = "ListenerServer"
        logging.getLogger().setLevel(settings["logging_level"])
        logging.debug("ListenerServer __init__")
        logging.info("listening on %s:%s", listen_host, listen_port)

        self.server = TCPServer((listen_host, listen_port), TCPRequestHandler)
        self.server.settings = settings
        dbh = DBHandler(settings)
        dbh.create_db()
        dbh.close()
        del dbh