Revision 6a0d36823178e5494a50abbd0a3f04e678e1284c authored by oshima on 09 June 2018, 08:07:01 UTC, committed by k8s-ci-robot on 09 June 2018, 08:07:01 UTC
Signed-off-by: YujiOshima <yuji.oshima0x3fd@gmail.com>
1 parent 3417891
main.py
import grpc
from concurrent import futures
import time
from pkg.api.python import api_pb2_grpc
from pkg.suggestion.bayesian_service import BayesianService
from pkg.suggestion.types import DEFAULT_PORT
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
api_pb2_grpc.add_SuggestionServicer_to_server(BayesianService(), server)
server.add_insecure_port(DEFAULT_PORT)
print("Listening...")
server.start()
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
server.stop(0)
if __name__ == "__main__":
serve()
Computing file changes ...