potiuk commented on a change in pull request #7505: [AIRFLOW-6883] Speed up import of airflow.utils.log.file_task_hanlder URL: https://github.com/apache/airflow/pull/7505#discussion_r382924947
########## File path: airflow/utils/log/file_task_handler.py ########## @@ -18,15 +18,17 @@ """File logging handler for tasks.""" import logging import os -from typing import Optional Review comment: > _Even_ if importing this one module was quick, it's still an extra import that is not needed at run time. That's a number of directory searches looking for the this one file, and a opening a file, parsing it etc. I believe removing __init__.py stuff is different (and much better) way of solving the long import time. When we properly move stuff out of __init__.py's for models (and other places). No single import will be expensive because we will only import what is needed and nothing more. Yes some "types" will be imported needlessly but those will really be types that will be immediately loaded if anything from this function is used and they are probably already imported elsewhere. By proper tree-like/lack-of-cycles/no implicit imports structure of the code we will achieve what we want to do now by manual TYPE_CHECKING removal of some stuf - avoid expensive imports where not needed. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
