def __next__()

in torchx/schedulers/local_scheduler.py [0:0]


    def __next__(self) -> str:
        log_fp = self._log_fp
        assert log_fp is not None
        while True:
            line = log_fp.readline()
            if not line:
                # we have reached EOF and app finished
                if self._app_finished:
                    log_fp.close()
                    raise StopIteration()

                # if app is still running we need to wait for more possible log lines
                # sleep for 1 sec to avoid thrashing the follow
                time.sleep(0.1)
                self._check_finished()
            else:
                line = line.rstrip("\n")  # strip the trailing newline
                if re.match(self._regex, line):
                    return line