Пример #1
0
 def do_run(self, client):
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     ip, port = client.split(":")
     s.connect((ip, int(port)))
     s.sendall(json.dumps(self.conf.__dict__))
     s.shutdown(socket.SHUT_WR)
     s_file = s.makefile("rb", 1)
     result = {}
     for line in s_file:
         match = self.final_re.search(line)
         if match:
             g = match.groups()
             result[g[1]] = {"count": g[0], "failures": g[2], "rate": g[3]}
         else:
             sys.stderr.write("%s %s" % (client, line))
     return result
Пример #2
0
 def do_run(self, client):
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     ip, port = client.split(':')
     s.connect((ip, int(port)))
     s.sendall(json.dumps(self.conf.__dict__))
     s.shutdown(socket.SHUT_WR)
     s_file = s.makefile('rb', 1)
     result = {}
     for line in s_file:
         match = self.final_re.search(line)
         if match:
             g = match.groups()
             result[g[1]] = {
                 'count': g[0],
                 'failures': g[2],
                 'rate': g[3],
             }
         else:
             sys.stderr.write('%s %s' % (client, line))
     return result