Birne94 opened a new issue, #37543: URL: https://github.com/apache/airflow/issues/37543
### Apache Airflow version main (development) ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? Airflow supports the [`secrets.use_cache`](https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#use-cache) option to speed up DAG file processing. According to the documentation, it "enables local caching of Variables, when parsing DAGs only". After enabling this option we found that the DAG processing is still slow when using the Airflow CLI. Looking at the code, the cache is not used at all because `SecretCache.init()` is only called [as part of DAG processing job](https://github.com/apache/airflow/blob/f2ea8a3e1753012bfe0d529c9c8be66cf55ca28f/airflow/dag_processing/manager.py#L1066C9-L1066C27), not however [when fetching DAGs from the CLI](https://github.com/apache/airflow/blob/f2ea8a3e1753012bfe0d529c9c8be66cf55ca28f/airflow/cli/commands/dag_command.py#L454). ### What you think should happen instead? When enabling secret caching, I would expect it to be applied for the CLI as well. ### How to reproduce 1. enable `secrets.use_cache` in airflow config 2. have a DAG that accesses variables in top-level code 3. run `airflow dags list-import-errors` 4. see that it takes very long to execute (20s in my case) ### Operating System Amazon Linux ### Versions of Apache Airflow Providers _No response_ ### Deployment Amazon (AWS) MWAA ### Deployment details _No response_ ### Anything else? _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org