def main(): iopoll = IOPoll() with iopoll.loop(): NTHREADS = 8 client = RaleighClient() with client.connection(iopoll, _RaleighJob.RALEIGH_HOST, _RaleighJob.RALEIGH_PORT): print 'Bench Ping' bench_run(NTHREADS, PingJob, None)
def main(): iopoll = IOPoll() with iopoll.loop(): NTHREADS = 8 client = RaleighClient() with client.connection(iopoll, _RaleighJob.RALEIGH_HOST, _RaleighJob.RALEIGH_PORT): object_name = 'bench-number' data = client.semantic_create(object_name, RaleighNumber.TYPE) try: print 'Bench Number-Insert' bench_run(NTHREADS, NumberIncJob, data['oid']) print 'Bench Number-Get' bench_run(NTHREADS, NumberGetJob, data['oid']) finally: client.semantic_delete(object_name)
def run(self): iopoll = IOPoll() with iopoll.loop(): client = RaleighClient() client.REPLY_MAX_WAIT = 20 with client.connection(iopoll, self.RALEIGH_HOST, self.RALEIGH_PORT): exception = None nrequests = 0 st = time() try: nrequests, exception = self.execute(client) except Exception as e: exception = e finally: et = time() return (et - st, nrequests, exception)