Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions airflow-core/src/airflow/dag_processing/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ def run(self):
By processing them in separate processes, we can get parallelism and isolation
from potentially harmful user code.
"""
# TODO: Temporary until AIP-92 removes DB access from DagProcessorManager.
# The manager needs MetastoreBackend to retrieve connections from the database
# during bundle initialization (e.g., GitDagBundle.__init__ → GitHook needs git credentials).
# This marks the manager as "server" context so ensure_secrets_backend_loaded() provides
# MetastoreBackend instead of falling back to EnvironmentVariablesBackend only.
# Child parser processes explicitly override this by setting _AIRFLOW_PROCESS_CONTEXT=client
# in _parse_file_entrypoint() to prevent inheriting server privileges.
# Related: https://github.com/apache/airflow/pull/57459
os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server"

self.register_exit_signals()

self.log.info("Processing files using up to %s processes at a time ", self._parallelism)
Expand Down
4 changes: 4 additions & 0 deletions airflow-core/src/airflow/dag_processing/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def _pre_import_airflow_modules(file_path: str, log: FilteringBoundLogger) -> No


def _parse_file_entrypoint():
# Mark as client-side (runs user DAG code)
# Prevents inheriting server context from parent DagProcessorManager
os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "client"

import structlog

from airflow.sdk.execution_time import comms, task_runner
Expand Down