saitejabandaru-in opened a new pull request, #72121: URL: https://github.com/apache/airflow/pull/72121
Closes #71801. ### Motivation When resolving `VariableInterval` deadlines (such as in `_process_dagrun_deadline_alerts`), the scheduler operates under `prohibit_commit`. However, querying `MetastoreBackend.get_variable` through `Variable.get_variable_from_secrets` does not pass down the session, which triggers `@provide_session` to create a scoped session that automatically commits upon exiting, thus tripping `UNEXPECTED COMMIT` guards. Because of this, callers had to duplicate the secrets backend iteration loop directly in `dag.py` (see #68917) instead of utilizing `get_variable_from_secrets`. ### Changes - Add `session=None` keyword-only argument to `Variable.get_variable_from_secrets`. - Explicitly check if the `secrets_backend` is `MetastoreBackend`, and if `session` is provided, forward it in the `call_secrets_backend_method` arguments. - This allows the caller's session to be reused across the metadata DB lookup without triggering unexpected commits, clearing the way for deduplicating the `dag.py` loop. -- 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]
