airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Pursell <willi...@wepay.com>
Subject Logging
Date Tue, 21 Nov 2017 13:27:43 GMT
I will be the first to admit that I'm a little confused about logging, but
I'm hoping someone can clarify what I think is a bug.  Or it's just my
misunderstanding of python.  Or a misunderstanding about logging.

I don't seem to be able to get much utility from having multiple log
handlers.  And I'm curious about this line of code:
https://github.com/apache/incubator-airflow/blob/master/airflow/www/views.py#L708

It feels like the code is trying to generate multiple possible handlers and
use the one that successfully finds the log, but the above mentioned line
is a bit of a fake generator.  In the sense that it calls 'next' to grab
the next value from the generator, but since the generator's scope is just
the local function, it always just grabs the first handler.  That is, other
than the default it might as well just be coded as a list comprehension:

handler = [handler for handler in logger.handlers if handler.name ==
task_log_reader][0]

So my question is: is this attempting to use multiple log handlers to find
the log and not doing so because  of a bug using 'next', or am I
misunderstanding what the log reader is trying to do?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message