Example #1
0
 def _call(name):
     content = client.invoke_sync(
         self.interface,
         "hello",
         SampleServicePbRequest(name=str(name)).SerializeToString(),
         timeout_ms=5000,
         spanctx=SpanContext())
     result = SampleServicePbResult()
     result.ParseFromString(content)
     print(result.result == str(name))
     _result.append(result.result == str(name))
Example #2
0
def _acall(name):
    client = AioClient("perftestapp")
    client.mesh_service_address = ("127.0.0.1", 12201)
    fs = [
        client.invoke_async(
            interface,
            "hello",
            SampleServicePbRequest(name=str(name)).SerializeToString(),
            timeout_ms=1000,
            spanctx=SpanContext()) for i in range(100)
    ]
    wait(fs)
Example #3
0
def _call(name):
    client = AioClient("perftestapp")
    client.mesh_service_address = ("127.0.0.1", 12201)
    for i in range(100):
        try:
            ret = client.invoke_sync(
                interface,
                "hello",
                SampleServicePbRequest(name=str(name)).SerializeToString(),
                timeout_ms=1000,
                spanctx=SpanContext())
        except Exception as e:
            pass
    print("{} finished".format(name))
def run_client(text):
    print("client start", text)
    spanctx = SpanContext()

    client = Client("test_app")
    client.subscribe(interface)

    content = client.invoke_sync(interface, "hello",
                                 SampleServicePbRequest(name=text).SerializeToString(),
                                 timeout_ms=5000, spanctx=spanctx)
    print("client", content)
    result = SampleServicePbResult()
    result.ParseFromString(content)

    print("client", result)