From 2d5b8a57a37d2b05514e452f744ead348fa5f369 Mon Sep 17 00:00:00 2001 From: Jonathan Jin Date: Tue, 16 Oct 2018 15:25:07 -0400 Subject: [PATCH] [AIRFLOW-3121] Define closed property on StreamLogWriter (#3955) [AIRFLOW-3121] Define closed property on StreamLogWriter --- airflow/utils/log/logging_mixin.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/airflow/utils/log/logging_mixin.py b/airflow/utils/log/logging_mixin.py index 442fecd0363c8..f3b490e6a3bcf 100644 --- a/airflow/utils/log/logging_mixin.py +++ b/airflow/utils/log/logging_mixin.py @@ -68,6 +68,7 @@ def _set_context(self, context): set_context(self.log, context) +# TODO: Formally inherit from io.IOBase class StreamLogWriter(object): encoding = False @@ -83,6 +84,16 @@ def __init__(self, logger, level): self.level = level self._buffer = str() + @property + def closed(self): + """ + Returns False to indicate that the stream is not closed (as it will be + open for the duration of Airflow's lifecycle). + + For compatibility with the io.IOBase interface. + """ + return False + def write(self, message): """ Do whatever it takes to actually log the specified logging record