From de076194c4a08c70a2a80e300fece917e621ca9c Mon Sep 17 00:00:00 2001 From: themrmax Date: Mon, 2 Aug 2021 05:33:38 -0700 Subject: [PATCH] Make ConsoleLogger flush after each logging line (#8810) This is necessary to avoid "logging blackouts" when running training on Kubernetes pods --- spacy/training/loggers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/training/loggers.py b/spacy/training/loggers.py index f7f70226d..5cf2db6b3 100644 --- a/spacy/training/loggers.py +++ b/spacy/training/loggers.py @@ -29,7 +29,7 @@ def console_logger(progress_bar: bool = False): def setup_printer( nlp: "Language", stdout: IO = sys.stdout, stderr: IO = sys.stderr ) -> Tuple[Callable[[Optional[Dict[str, Any]]], None], Callable[[], None]]: - write = lambda text: stdout.write(f"{text}\n") + write = lambda text: print(text, file=stdout, flush=True) msg = Printer(no_print=True) # ensure that only trainable components are logged logged_pipes = [