grpc

Mocking gRPC status code ('RpcError' object has no attribute 'code') in Flask App

北慕城南 提交于 2021-01-29 14:51:50
问题 I have to create a unittest that should mock a specific grpc status code (in my case I need NOT_FOUND status). This is what i want to mock: try: # my mocked function except grpc.RpcError as e: if e.code() == grpc.StatusCode.NOT_FOUND: # do something My unittest until now looks like this: def mock_function_which_raise_RpcError(): e = grpc.RpcError(grpc.StatusCode.NOT_FOUND) raise e class MyTestCase(BaseViewTestCase): @property def base_url(self): return '/myurl' @mock.patch('my_func', mock

GRPC/C++ - How to detect client disconnected in Async Server

旧巷老猫 提交于 2021-01-29 14:27:50
问题 I am using the code of this example to create my GRPC async server: #include <memory> #include <iostream> #include <string> #include <thread> #include <grpcpp/grpcpp.h> #include <grpc/support/log.h> #ifdef BAZEL_BUILD #include "examples/protos/helloworld.grpc.pb.h" #else #include "helloworld.grpc.pb.h" #endif using grpc::Server; using grpc::ServerAsyncResponseWriter; using grpc::ServerBuilder; using grpc::ServerContext; using grpc::ServerCompletionQueue; using grpc::Status; using helloworld:

Run a Python gRPC server on Google Cloud Run

妖精的绣舞 提交于 2021-01-29 11:23:34
问题 I have a basic, proof-of-concept Python gRPC server. When I run my docker container locally, I can make requests to the server and receive responses on the exposed port. I can successfully deploy the server to Cloud Run, and I see the service running in the Cloud Run UI. However, I am unable to access the Cloud Run version from a client. I am looking for suggestions to help me access this server, whether it is changes to the clients or the server. Client code: with grpc.insecure_channel('...

Issues with maven dependencies: UnsolvableVersionConflictException

梦想的初衷 提交于 2021-01-29 08:43:47
问题 Im new in grpc and java. I have a big problem with my dependencies: Caused by: org.eclipse.aether.collection.UnsolvableVersionConflictException: Could not resolve version conflict among [io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-netty:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io.grpc:grpc-okhttp:jar:1.27.1 -> io.grpc:grpc-core:jar:[1.27.1,1.27.1], io.grpc:grpc-all:jar:1.27.1 -> io

TF model served using docker & C++ inference client on Windows 10

你说的曾经没有我的故事 提交于 2021-01-29 07:16:35
问题 I am trying code up a c++ tensorflow client to push images to the model which is served via tensorflow-serve docker, on Windows 10. docker run -p 8501:8501 --name tfserving_model_test --mount type=bind,source=D:/docker_test/model,target=/models/model -e MODEL_NAME=test_model -t tensorflow/serving Trying a simple code which was a part of TF serve (resnet_client.cc) example where I am passing a black image. // Preparing required variables to make a predict request. PredictRequest predictRequest

connecting google firestore to php - grpc not found

大城市里の小女人 提交于 2021-01-29 07:00:43
问题 I am trying to connect php to firestore database following this repo https://github.com/googleapis/google-cloud-php-firestore. Google Cloud Firestore for php requires grpc extension to be installed. I have installed grpc through pecl and it says it is perfectly installed. But whenever I try to run the code, it says firestore could not connect because grpc extension could not be found. I am attaching the screenshots of errors here. I have even added grpc to php.ini file, not sure why this

Prebuilding grpc and find_package

混江龙づ霸主 提交于 2021-01-28 18:15:10
问题 I'd like to link my application with a prebuilt gRPC 1.30. The directory structure that I want: - project root - external + gRPC - src ... my source code here ... I've built gRPC: git clone --recurse-submodules -b v1.30.0 https://github.com/grpc/grpc cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="D:/grpc" -A x64 .. cmake --build . --target install --config Release The final structure of files produced in D:/grpc is weird... the topmost cmake folder contains protobuf

gRPC Python - how to add idle time for client

拥有回忆 提交于 2021-01-28 09:04:44
问题 I'm using gRPC to call a service in client. After I set up channel: channel = grpc.insecure_channel('server_url:service_port') stub = Client.Stub(channel) It works pretty good. However, if there's 5 minutes not using the client to send request, then the next request will get error message: grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNKNOWN, Stream removed)> 回答1: Unfortunately the gRPC retries functionality when the channel breaks is still work in progress

SSL error with GRPC Java

走远了吗. 提交于 2021-01-28 07:58:35
问题 JDK version : 1.8u77 proto3.0.3 version I have tried incorporating SSL into current application. Please find below approaches we have tried. 1) OpenSSL Static approach We have added the io.netty.tcnative-boringssl-static, io.netty.handler and bundles to com.pelco.vms.pelcotools.application.bnd and Tried the below code snippet (added to RPCHandler) : SslContext sslContext = SslContextBuilder.forServer(certificatePemFile, privateKeyPemFile)) .sslProvider(SslProvider.OPENSSL) .build(); server =

gRPC client do not dispose Channel

为君一笑 提交于 2021-01-27 16:08:22
问题 I'm developing .net core 2.0 application with gRPC and find out a problem: after delete reference to instance of my gRPC client class, there still channel that use resourses (memory and processor). Example code: public class MyClient : ClientBase { public MyClient(Channel channel) : base(channel) { } } internal class Program { private static void Main(string[] args) { var list = new List<MyClient>(); for (var i = 0; i < 10000; i++) { Console.WriteLine($"Creating {i} instance"); list.Add(new