Exemplo n.º 1
0
def main():

    options = parse_options()

    options.dbargs = {'host': options.host, 
                      'port': options.port, 
                      'user': options.user, 
                      'passwd': options.passwd, 
                      'db': options.db}
        
    if options.use_pool:
        options.pool = Pool(client, options.dbargs, options.use_pool)
    
    for i in range(options.sessions):
        session = Session(options)
        Tasklet.new(session.run)()

    try:
        query_count = options.query_count
        start = time.time()
        query_count_done = sum(Tasklet.join_children())
        end = time.time()
        print end - start, query_count_done, query_count_done / (end - start)
    except Exception:
        logging.exception("must be an error in one of the sessions")
    
    quit()
Exemplo n.º 2
0
 def run(self):
     #show stats every second:
     Tasklet.interval(1.0, self.show, immediate = True)()
     
     #dispenses tokens for doing a request to sessions:
     Tasklet.new(self.dispense)()
     
     #start up sessions, and wait till they are finished
     Tasklet.join_all([Tasklet.new(self.sessions)() for _ in range(self.options.sessions)])
     
     quit()
Exemplo n.º 3
0
 def quit_test():
     logging.error("quiting unittest on timeout")
     quit(EXIT_CODE_TIMEOUT)
Exemplo n.º 4
0
 def quit_test():
     if ontimeout:
         ontimeout()
     logging.error("quiting unittest on timeout")
     quit(EXIT_CODE_TIMEOUT)