jason810496 commented on code in PR #64209:
URL: https://github.com/apache/airflow/pull/64209#discussion_r3000685313
##########
shared/configuration/src/airflow_shared/configuration/parser.py:
##########
@@ -1968,28 +2010,23 @@ def make_sure_configuration_loaded(self,
with_providers: bool) -> Generator[None
"""
Make sure configuration is loaded with or without providers.
- This happens regardless if the provider configuration has been loaded
before or not.
- Restores configuration to the state before entering the context.
+ The context manager will only toggle the
`self._use_providers_configuration` flag if `with_providers` is False, and will
reset `self._use_providers_configuration` to True after the context block.
+ Nop for `with_providers=True` as the configuration already loads
providers configuration by default.
:param with_providers: whether providers should be loaded
"""
- needs_reload = False
- if with_providers:
- self._ensure_providers_config_loaded()
- else:
- needs_reload = self._ensure_providers_config_unloaded()
- yield
- if needs_reload:
- self._reload_provider_configs()
-
- def _ensure_providers_config_loaded(self) -> None:
- """Ensure providers configurations are loaded."""
- raise NotImplementedError("Subclasses must implement
_ensure_providers_config_loaded method")
-
- def _ensure_providers_config_unloaded(self) -> bool:
- """Ensure providers configurations are unloaded temporarily to load
core configs. Returns True if providers get unloaded."""
- raise NotImplementedError("Subclasses must implement
_ensure_providers_config_unloaded method")
-
- def _reload_provider_configs(self) -> None:
- """Reload providers configuration."""
- raise NotImplementedError("Subclasses must implement
_reload_provider_configs method")
+ if not with_providers:
+ self._use_providers_configuration = False
+ # Only invalidate cached properties that depend on
_use_providers_configuration.
+ # Do NOT use invalidate_cache() here — it would also evict
expensive provider-discovery
+ # caches (_provider_metadata_configuration_description,
_provider_metadata_config_fallback_default_values)
+ # that don't depend on this flag.
+ self.__dict__.pop("configuration_description", None)
+ self.__dict__.pop("sensitive_config_values", None)
Review Comment:
Addressed in
[a1955d2](https://github.com/apache/airflow/pull/64209/commits/a1955d237dc67fc8648c3a0afbc368003e8a2add)
--
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]