Example #1
0
    def run(self):
        sock = self.conn_pool.get_conn()
        before = datetime.datetime.now()

        comm.TaggedMessage(comm.WORK, 0).to_socket(sock)
        comm.send_string(sock, self.job.descr['work'])
        comm.TaggedMessage.from_socket(sock)
        self.job.actual_resp = comm.recv_string(sock)

        after = datetime.datetime.now()
        self.job.latency = after - before

        self.log("Request %d: req: \"%s\", resp: \"%s\", latency: %d ms" %
                 (self.job.id, self.job.descr['work'], self.job.actual_resp,
                  1000 * self.job.latency.total_seconds()))

        self.conn_pool.put_conn(sock)

        # validation
        self.job.success = self.validate_response(self.job.actual_resp,
                                                  self.job.descr['resp'])
        if not (self.job.success or args.ignoreerror):
            self.log("ERROR: incorrect response to req %d: (req: %s)" %
                     (self.job.id, self.job.descr['work']))
            self.log("       expected: '%s'" % self.job.descr['resp'])
            self.log("       received: '%s'" % self.job.actual_resp)
Example #2
0
    def run(self):
        addr = comm.recv_string(self.sock)
        if args.verbose:
            print "Master is listening on %s" % addr

        threads = []
        worker_args = comm.recv_string(self.sock)
        while worker_args:
            t = WorkerHandler(self.launch_worker, addr, worker_args)
            threads.append(t)
            t.start()
            try:
                worker_args = comm.recv_string(self.sock)
            except comm.SocketClosed:
                if args.verbose:
                    print "Connection closed with %s" % addr
                break

        for t in threads:
            t.join()

        if args.verbose:
            print "Connection from %s closed" % addr
        self.sock.close()
    def run(self):
        addr = comm.recv_string(self.sock)
        if args.verbose:
            print "Master is listening on %s" % addr

        threads = []
        worker_args = comm.recv_string(self.sock)
        while worker_args:
	    t = WorkerHandler(self.launch_worker, addr, worker_args)
	    threads.append(t)
	    t.start()
	    try:
	      worker_args = comm.recv_string(self.sock)
	    except comm.SocketClosed:
	      if args.verbose:
	         print "Connection closed with %s" % addr
	      break;

	for t in threads:
	    t.join()

        if args.verbose:
            print "Connection from %s closed" % addr
        self.sock.close()
    def run(self):
	sock = self.conn_pool.get_conn()
	before = datetime.datetime.now()

        comm.TaggedMessage(comm.WORK, 0).to_socket(sock)
	comm.send_string(sock, self.job.descr['work'])
	comm.TaggedMessage.from_socket(sock)
        self.job.actual_resp = comm.recv_string(sock)

	after = datetime.datetime.now()
        self.job.latency = after - before

        self.log("Request %d: req: \"%s\", resp: \"%s\", latency: %d ms" % (self.job.id, self.job.descr['work'], self.job.actual_resp, 1000 * self.job.latency.total_seconds()))
        
	self.conn_pool.put_conn(sock)
        
        # validation
        self.job.success = self.validate_response(self.job.actual_resp, self.job.descr['resp'])
        if not (self.job.success or args.ignoreerror):
            self.log("ERROR: incorrect response to req %d: (req: %s)" % (self.job.id, self.job.descr['work']))
            self.log("       expected: '%s'" % self.job.descr['resp']);
            self.log("       received: '%s'" % self.job.actual_resp);
Example #5
0
######################################################################

conn_pool = ConnectionPool(args.address)

######################################################################
# wait until the server is ready before sending requests
######################################################################

print "Waiting for server to initialize..."
server_ready = False
while not server_ready:
    sock = conn_pool.get_conn()

    comm.TaggedMessage(comm.ISREADY, 0).to_socket(sock)
    comm.TaggedMessage.from_socket(sock)
    resp = comm.recv_string(sock)
    if resp == "ready":
        server_ready = True
    else:
        time.sleep(0.5)

######################################################################
# Server is ready. Start the trace
######################################################################

print "Server ready, beginning trace..."

start_time = datetime.datetime.now()
traceJobs = []

######################################################################
            
conn_pool = ConnectionPool(args.address)

######################################################################
# wait until the server is ready before sending requests
######################################################################

print "Waiting for server to initialize...";
server_ready = False
while not server_ready:
  sock = conn_pool.get_conn()
  
  comm.TaggedMessage(comm.ISREADY, 0).to_socket(sock)
  comm.TaggedMessage.from_socket(sock)
  resp = comm.recv_string(sock)
  if resp == "ready":
    server_ready = True;
  else:
    time.sleep(0.5);

######################################################################
# Server is ready. Start the trace
######################################################################
    
print "Server ready, beginning trace...";
    
start_time = datetime.datetime.now()
traceJobs = []

def all_threads():