37b2679112
Importing anything from airflow.models pulls in _a lot_ of airflow, so delay imports until the functions are called, or make use of the `TYPE_CHECKING` to not actually import at runtime. **Before**: mean 2.58s (with a lot of variance) ``` airflow ❯ for i in 1 2 3; do time airflow --help >/dev/null; done airflow --help > /dev/null 2.00s user 1.39s system 176% cpu 1.928 total airflow --help > /dev/null 2.84s user 1.43s system 151% cpu 2.817 total airflow --help > /dev/null 3.00s user 1.37s system 145% cpu 3.009 total ``` **After**: 0.526s ``` airflow --help > /dev/null 0.39s user 0.04s system 99% cpu 0.435 total airflow --help > /dev/null 0.40s user 0.05s system 99% cpu 0.446 total airflow --help > /dev/null 0.64s user 0.05s system 99% cpu 0.698 total ``` This also has an advantage in development where a syntax error doesn't fail with a slightly confusing error message about "unable to configure logger 'task'". |
||
---|---|---|
.. | ||
__init__.py | ||
cloudwatch_task_handler.py | ||
colored_log.py | ||
es_task_handler.py | ||
file_processor_handler.py | ||
file_task_handler.py | ||
gcs_task_handler.py | ||
json_formatter.py | ||
log_reader.py | ||
logging_mixin.py | ||
s3_task_handler.py | ||
stackdriver_task_handler.py | ||
task_handler_with_custom_formatter.py | ||
wasb_task_handler.py |