You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by am...@apache.org on 2025/06/17 08:32:24 UTC
(airflow) branch main updated: Remove unnecessary logs while retrieving connections / variables (#51786)
This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 23ecee8c08d Remove unnecessary logs while retrieving connections / variables (#51786)
23ecee8c08d is described below
commit 23ecee8c08dc1bc5e5e12151ccd3eb39632d739d
Author: Amogh Desai <am...@gmail.com>
AuthorDate: Tue Jun 17 14:02:18 2025 +0530
Remove unnecessary logs while retrieving connections / variables (#51786)
---
task-sdk/src/airflow/sdk/execution_time/context.py | 24 +++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/task-sdk/src/airflow/sdk/execution_time/context.py b/task-sdk/src/airflow/sdk/execution_time/context.py
index 438687bdeb8..6621b9c61ed 100644
--- a/task-sdk/src/airflow/sdk/execution_time/context.py
+++ b/task-sdk/src/airflow/sdk/execution_time/context.py
@@ -125,7 +125,8 @@ def _get_connection(conn_id: str) -> Connection:
# enabled only if SecretCache.init() has been called first
# iterate over configured backends if not in cache (or expired)
- for secrets_backend in ensure_secrets_backend_loaded():
+ backends = ensure_secrets_backend_loaded()
+ for secrets_backend in backends:
try:
conn = secrets_backend.get_connection(conn_id=conn_id)
if conn:
@@ -137,10 +138,11 @@ def _get_connection(conn_id: str) -> Connection:
type(secrets_backend).__name__,
)
- log.debug(
- "Connection not found in any of the configured Secrets Backends. Trying to retrieve from API server",
- conn_id=conn_id,
- )
+ if backends:
+ log.debug(
+ "Connection not found in any of the configured Secrets Backends. Trying to retrieve from API server",
+ conn_id=conn_id,
+ )
# TODO: This should probably be moved to a separate module like `airflow.sdk.execution_time.comms`
# or `airflow.sdk.execution_time.connection`
@@ -172,8 +174,9 @@ def _get_variable(key: str, deserialize_json: bool) -> Any:
from airflow.sdk.execution_time.supervisor import ensure_secrets_backend_loaded
var_val = None
+ backends = ensure_secrets_backend_loaded()
# iterate over backends if not in cache (or expired)
- for secrets_backend in ensure_secrets_backend_loaded():
+ for secrets_backend in backends:
try:
var_val = secrets_backend.get_variable(key=key) # type: ignore[assignment]
if var_val is not None:
@@ -190,10 +193,11 @@ def _get_variable(key: str, deserialize_json: bool) -> Any:
type(secrets_backend).__name__,
)
- log.debug(
- "Variable not found in any of the configured Secrets Backends. Trying to retrieve from API server",
- key=key,
- )
+ if backends:
+ log.debug(
+ "Variable not found in any of the configured Secrets Backends. Trying to retrieve from API server",
+ key=key,
+ )
# TODO: This should probably be moved to a separate module like `airflow.sdk.execution_time.comms`
# or `airflow.sdk.execution_time.variable`