add_asr.py 898 B

1234567891011121314151617181920212223242526
  1. import logging as Log
  2. import grpc,argparse,time,sys,threading
  3. import mllp_grpc.asr_pb2_grpc as asr_pb2_grpc
  4. import mllp_grpc.asr_pb2 as asr_pb2
  5. import mllp_grpc.asr_common_pb2 as asr_common_pb2
  6. import google.protobuf.empty_pb2 as empty_pb2
  7. from math import ceil
  8. ASR_SERVER_HOST = "localhost"
  9. ASR_SERVER_PORT = 8041
  10. ASR_SYSTEM_HOST = "localhost"
  11. ASR_SYSTEM_PORT = 8042
  12. if __name__=='__main__':
  13. Log.basicConfig(level=Log.INFO)
  14. addr= '%s:%d'%(ASR_SERVER_HOST, ASR_SERVER_PORT)
  15. with grpc.insecure_channel(addr) as channel:
  16. stub= asr_pb2_grpc.ASRStub(channel)
  17. for info in stub.GetSystemsInfo(empty_pb2.Empty()):
  18. print(info)
  19. res= stub.AddSystem(asr_pb2.AddSystemRequest(host=ASR_SYSTEM_HOST,
  20. port=ASR_SYSTEM_PORT))
  21. for info in stub.GetSystemsInfo(empty_pb2.Empty()):
  22. print(info)