Ejemplo n.º 1
0
def run(server_address, thread_id, count, queries):
    channel = grpc.insecure_channel(server_address)
    resembla = resembla_pb2.ResemblaServiceStub(channel)

    results = []
    t_start = time_mill()
    for i in range(count):
        for query in queries:
            t0 = time_mill()
            responses = resembla.find(
                resembla_pb2.ResemblaRequest(query=query),
                _TIMEOUT_SECONDS).results
            for response in responses:
                pass
            t1 = time_mill()
            results.append((thread_id, 'query/' + query, str(t1 - t0)))
    t_end = time_mill()
    t_average = 0
    for r in results:
        t_average = t_average + float(r[2])
    t_average = t_average / len(results)
    results.append((thread_id, 'total', str(t_end - t_start)))
    results.append((thread_id, 'average', str(t_average)))
    for r in results:
        print('\t'.join(r))
Ejemplo n.º 2
0
def run(server_address, queries):
  channel = grpc.insecure_channel(server_address)
  resembla = resembla_pb2.ResemblaServiceStub(channel)

  for s in queries:
    print ('query=%s' % s)
    responses = resembla.find(resembla_pb2.ResemblaRequest(query=s), _TIMEOUT_SECONDS).results
    for response in responses:
      print ('  response.text=%s' % response.text)
      print ('  response.score=%s' % response.score)
Ejemplo n.º 3
0
def run(server_address, queries):
    channel = grpc.insecure_channel(server_address)
    resembla = resembla_pb2.ResemblaServiceStub(channel)

    for (query, candidates) in queries:
        print('query=%s' % query)
        print('candidates=%s' % ', '.join(candidates))
        responses = resembla.eval(
            resembla_pb2.ResemblaOnDemandRequest(query=query,
                                                 candidates=candidates),
            _TIMEOUT_SECONDS).results
        for response in responses:
            print('  response.text=%s' % response.text)
            print('  response.score=%s' % response.score)