18 lines
583 B
Python
18 lines
583 B
Python
from concurrent.futures import ThreadPoolExecutor
|
|
import grpc
|
|
from api.proto import routes_pb2, routes_pb2_grpc
|
|
|
|
|
|
class RouteApproachesServicer(routes_pb2_grpc.RouteApproachesServicer):
|
|
def GetApproach(self, request, context):
|
|
print("Hello")
|
|
return routes_pb2.Approach(weight=100, reps=12)
|
|
|
|
def serve():
|
|
server = grpc.server(ThreadPoolExecutor(max_workers=10))
|
|
routes_pb2_grpc.add_RouteApproachesServicer_to_server(RouteApproachesServicer(), server)
|
|
server.add_insecure_port("[::]:50051")
|
|
server.start()
|
|
server.wait_for_termination()
|
|
|
|
serve()
|