mathbou commented on PR #30367:
URL: https://github.com/apache/airflow/pull/30367#issuecomment-1490841639

   >  in some cases whatever "initialize_settings" (which the variable disable) 
does, is needed in the next step. From what I know initializing settings for 
example makes sure that if you have no config file it will generate one - 
including default values, by disabling it via the variable, this side-efect 
might be gone (and if something else relies on it, it might be broken).
   
   About the initialize side effect you're describing:
   - first off, it would be really bad to depends on this call to get the 
initialization side effect, it's closer to a misuse than anything else.
   - second, by digging deeper I finally found where is the proper 
initialization call for Airflow 
https://github.com/apache/airflow/blob/6e751812d2e48b743ae1bc375e3bebb8414b4a0e/airflow/utils/python_virtualenv_script.jinja2#L28-L30
 It's at the very top of the script that the `External` and `Virtualenv` python 
operators will run to execute tasks, so the `settings.initialize()` will happen.
   
   Only with this second point, I would say it's safe to assume that production 
and debug will behave the same. I already ran some Dags with this fix in both 
configurations without problems.
   
   ---
   
   > find or add a way to disable those debug logs (and only them, nothing 
else) rather than using _AIRFLOW__AS_LIBRARY
   
   Disabling debug logs while in debug mode would be quite ironic, and as we 
need them for debug purposes, we would need to disable them only for this very 
specific case. I don't think this case is special enough to add that much 
complexity to three methods of the `settings.py` module.
   
   > only add _AIRFLOW__AS_LIBRARY in case DEBUG level is set.
   
   This solution is a nonsense to me, it would add a risk of different behavior 
between production and debug, and that exactly what we are trying to avoid here.


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

Reply via email to