uranusjr commented on code in PR #27758: URL: https://github.com/apache/airflow/pull/27758#discussion_r1073078112
########## airflow/cli/commands/task_command.py: ########## @@ -69,6 +70,18 @@ CreateIfNecessary = Union[Literal[False], Literal["db"], Literal["memory"]] +def _set_task_deferred_context_var(): + """ + Tell task log handler that task exited with deferral. + + :meta private: + """ + logger = logging.getLogger() + h = next((h for h in logger.handlers if hasattr(h, "ctx_task_deferred")), None) + if h: + h.ctx_task_deferred = True Review Comment: Yeah the main thing is truthy evaluation, or any evaluation really. This is probably not an issue for `logger.handlers` in practice, but it’s better to avoid readers needing to consider the posibility entirely. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
