예제 #1
0
def main(argv):
  del argv
  tf.compat.v1.enable_v2_behavior()
  executor = framework.create_local_executor()(None)
  if FLAGS.private_key:
    if FLAGS.certificate_chain:
      with open(FLAGS.private_key, 'rb') as f:
        private_key = f.read()
      with open(FLAGS.certificate_chain, 'rb') as f:
        certificate_chain = f.read()
      credentials = grpc.ssl_server_credentials(((
          private_key,
          certificate_chain,
      ),))
    else:
      raise ValueError(
          'Private key has been specified, but the certificate chain missing.')
  else:
    credentials = None
  server_utils.run_server(executor, FLAGS.threads, FLAGS.port, credentials)
예제 #2
0
 def noarg_run_server():
     server_utils.run_server(ex, 1, 8888)