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))
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)
        def hello(self, bs):
            # add a delay
            time.sleep(randint(50, 300) / 100)

            obj = SampleServicePbRequest()
            obj.ParseFromString(bs)
            print("server: Processing request", obj)
            return SampleServicePbResult(result=obj.name).SerializeToString()
Example #4
0
 def hello(self, bs: bytes):
     # add a delay
     # time.sleep(randint(50, 300) / 1000)
     obj = SampleServicePbRequest()
     obj.ParseFromString(bs)
     ret = SampleServicePbResult(result=obj.name).SerializeToString()
     counter.inc()
     return ret
Example #5
0
            def hello(self, bs):
                # add a delay
                time.sleep(self._seed)

                obj = SampleServicePbRequest()
                obj.ParseFromString(bs)
                print("Processing Request", obj)
                return SampleServicePbResult(
                    result=obj.name).SerializeToString()
    def hello(self, bs):
        # add a delay
        time.sleep(randint(50, 300) / 100)

        obj = SampleServicePbRequest()
        obj.ParseFromString(bs)
        print("server: Processing request", obj)
        # reference a pre init member
        ret = obj.name + self._name
        return SampleServicePbResult(result=ret).SerializeToString()
 def _cb(content, expect):
     result = SampleServicePbResult()
     result.ParseFromString(content)
     print(expect == result.result)
     _result.append(expect == result.result)