abhijeets25012-tech opened a new pull request, #76184:
URL: https://github.com/apache/airflow/pull/76184

   Executor callbacks run in their own subprocess, and that subprocess never 
sets the current team. A callback for a team's Dag therefore resolved 
`Variable.get` / `Connection.get` through the secrets backends without a team, 
so the global `AIRFLOW_VAR_*` / `AIRFLOW_CONN_*` won over the team-scoped value.
   
   This threads the team through the callback path:
   
   * `ExecuteCallback` carries `team_name`, taken from `dag_run.team_name` in 
`ExecuteCallback.make`.
   * `BaseExecutor.run_workload` passes it to `supervise_callback`, which 
forwards it to `CallbackSubprocess.start`.
   * The callback child calls `set_current_team_name(team_name)` before the 
bundle is initialized and before callback code is imported, so lookups made at 
import time already use the team.
   
   Stacked on #75998, which adds `set_current_team_name`; this PR only adds the 
last commit. I will rebase it onto `main` once #75998 merges, so please review 
#75998 first.
   
   closes: #76102
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Qoder following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   ##### Testing
   
   * `task-sdk/tests/task_sdk/execution_time/test_callback_supervisor.py`: 43 
passed. New tests cover the team being set before the callback runs, the team 
reaching the subprocess from `supervise_callback`, and the issue's repro — a 
callback child whose `Variable.get` returns `team_a_value` rather than 
`global_value`.
   * 
`airflow-core/tests/unit/executors/{test_workloads,test_local_executor,test_base_executor}.py`:
 219 passed, 3 skipped (skips are the pre-existing non-fork start-method ones).
   * `ExecuteCallback.make` copies `team_name`, and `run_workload` forwards it; 
both assertions were confirmed to fail with the source change reverted.
   * `ruff check` and `ruff format --check` pass on all six changed files.


-- 
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]

Reply via email to