def push_examples(example_generator, port, max_queue_size, queue_timeout):
  """Create a server and continuously push examples from a generator.

  Args:
    example_generator: Generator that yields examples.
    port: Port for the gRPC server to listen on.
    max_queue_size: Number of example to queue.
    queue_timeout: Queue timeout argument. None to block forever, otherwise time
      in seconds.
  """
  servicer = PreprocessingServicer(max_queue_size=max_queue_size)
  server = create_and_start_server(port, servicer)
  for i, example in enumerate(example_generator):
    servicer.PushExample(example, timeout=queue_timeout)
    if i % 500 == 0:
      tf.logging.info("Attempted to push %d examples.", i)
      tf.logging.info("Queue size is %d.", servicer.QueueSize())
  server.stop(120.0)  # The argument is grace period in seconds.
Create a server and continuously push examples from a generator.

  Args:
    example_generator: Generator that yields examples.
    port: Port for the gRPC server to listen on.
    max_queue_size: Number of example to queue.
    queue_timeout: Queue timeout argument. None to block forever, otherwise time
      in seconds.
  
language/realm/preprocessing.py