def newest_checkpoint(self,
                        timeout: int = 3600 * 8,
                        include_tmp: bool = False) -> Iterable[str]:
    """Yield the newest unevaluated checkpoint.

    Args:
      timeout: Optional timeout for waiting for new checkpoints. Set this to do
        continious evaluation.
      include_tmp: Whether to evaluate tmp checkpoints.

    Yields:
      Path to the latest unevaluated checkpoint.
    """

    def _find_latest_checkpoint(
        checkpoints: Iterable[str]) -> Tuple[int, Optional[str]]:
      sorted_ckpts = sorted((int(x.split('_')[-1]), x) for x in checkpoints)
      if sorted_ckpts:
        return sorted_ckpts[-1]
      else:
        return -1, None

    logging.info('Looking for checkpoints in %s', self._model_dir)
    evaluated_checkpoints = self._get_checkpoints_with_results()
    last_eval_step, _ = _find_latest_checkpoint(evaluated_checkpoints)

    last_eval = time.time()
    while not (time.time() - last_eval > timeout or self.is_training_done()):
      # Check if directory exists. The train job may only create the directory
      # some time after the test job starts.
      if tf.io.gfile.exists(self.model_dir):
        checkpoints = tf.io.gfile.glob(
            os.path.join(self._model_dir, 'checkpoint*')
        )
        if include_tmp:
          checkpoints = set(checkpoints)
        else:
          checkpoints = set([x for x in checkpoints if 'tmp' not in x])
        last_step, last_ckpt = _find_latest_checkpoint(checkpoints)

        if last_step > last_eval_step:
          # update the time *before* yielding to prevent long evals from
          # triggering the loop breaking condition.
          last_eval = time.time()
          last_eval_step = last_step
          yield last_ckpt

      time.sleep(5)
Yield the newest unevaluated checkpoint.

    Args:
      timeout: Optional timeout for waiting for new checkpoints. Set this to do
        continious evaluation.
      include_tmp: Whether to evaluate tmp checkpoints.

    Yields:
      Path to the latest unevaluated checkpoint.
    
videogvt/train_lib/task_manager.py