kaxil commented on pull request #9910:
URL: https://github.com/apache/airflow/pull/9910#issuecomment-662088192


   > @kaxil In `dagrun.py`, having
   > 
   > ```python
   > # airflow/__init__.py > airflow/models/__init__.py > 
airflow/models/dagrun.py
   > from airflow.settings import task_instance_mutation_hook
   > ```
   > 
   > will load `task_instance_mutation_hook` with the default implementation 
inside `settings.py` which will **later updated** (when 
[settings.initialize()](https://github.com/apache/airflow/blob/d23fa2f8896c5e31745131e6917f1970b4aa590f/airflow/__init__.py#L48)
 called, and 
[airflow_local_settings](https://github.com/apache/airflow/blob/d23fa2f8896c5e31745131e6917f1970b4aa590f/airflow/settings.py#L400)
 provided). The import of `task_instance_mutation_hook` will result in caching 
the old implementation and the change in this PR will drop this caching so 
calling `settings.task_instance_mutation_hook` will get you the fresh 
implementation of `task_instance_mutation_hook`( after _settings.initialize_ 
load the _airflow_local_settings_).
   
   when you run `airflow scheduler` or `airflow webserver` it loads ` from 
airflow import settings` that already initializes the settings
   
   
https://github.com/apache/airflow/blob/4eddce22a3e0eb605f5661204a005262bbaa54cd/airflow/cli/commands/scheduler_command.py#L24
   
https://github.com/apache/airflow/blob/4eddce22a3e0eb605f5661204a005262bbaa54cd/airflow/settings.py


----------------------------------------------------------------
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]


Reply via email to