Birne94 commented on code in PR #37551:
URL: https://github.com/apache/airflow/pull/37551#discussion_r1495837191


##########
airflow/__main__.py:
##########
@@ -54,6 +55,11 @@ def main():
         conf = write_default_airflow_configuration_if_needed()
         if args.subcommand in ["webserver", "internal-api", "worker"]:
             write_webserver_configuration_if_needed(conf)
+

Review Comment:
   The way that secret caching is implemented currently is that the 
`SecretCache` class is always used for looking up. If caching is not explicitly 
enabled, the cache [will never be 
initialized](https://github.com/apache/airflow/blob/08bc0f44904fe0d8bc8779e0e892e4d42def3983/airflow/secrets/cache.py#L57-L59)
 and essentially is a no-op.
   
   The problem is that `SecretCache.init()` is only called [in the dag 
processing 
job](https://github.com/apache/airflow/blob/08bc0f44904fe0d8bc8779e0e892e4d42def3983/airflow/dag_processing/manager.py#L1066).
 This means that if we configure caching and process the DAG there, it will 
work as expected. However if we load a DAG from any other place (e.g. the CLI), 
our caching configuration is ignored and cache creation is skipped.
   
   With the change I suggest, the `secrets.use_cache` option will be honored 
from the CLI and caching will be enabled as expected.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to