def test_with_grpc(self):
     server = grpc.server(UnboundedThreadPoolExecutor())
     try:
         beam_artifact_api_pb2_grpc.add_ArtifactStagingServiceServicer_to_server(
             self._service, server)
         beam_artifact_api_pb2_grpc.add_ArtifactRetrievalServiceServicer_to_server(
             self._service, server)
         port = server.add_insecure_port('[::]:0')
         server.start()
         channel = grpc.insecure_channel('localhost:%d' % port)
         self._run_staging(
             beam_artifact_api_pb2_grpc.ArtifactStagingServiceStub(channel),
             beam_artifact_api_pb2_grpc.ArtifactRetrievalServiceStub(
                 channel))
         channel.close()
     finally:
         server.stop(1)
Example #2
0
 def artifact_service(self):
     return beam_artifact_api_pb2_grpc.ArtifactRetrievalServiceStub(
         self._channel, **self._kwargs)