The GitHub Actions job "Check newsfragment PR number" on airflow.git/feature/mutation-hook-dag-run has failed. Run started by GitHub user dheerajturaga (triggered by dheerajturaga).
Head commit for run: 0a3cd6a0e1f79af2a44f46192a0405d19c00934e / Dheeraj Turaga <[email protected]> Pass DagRun to task_instance_mutation_hook for run-aware task mutation Cluster policies could mutate a TaskInstance before scheduling but had no supported way to read the DagRun it belongs to -- so routing a task to a queue based on the run's configuration was impossible. Reaching the DagRun via TaskInstance.get_dagrun() opens a nested committing session that trips the scheduler's prohibit_commit guard and crashes the scheduler. Add an optional dag_run argument to the task_instance_mutation_hook policy hook and thread the in-scope DagRun through every scheduler-side call site (no extra database access). A hook can now route on dag_run.conf, for example: def task_instance_mutation_hook(task_instance, dag_run=None): if dag_run is not None and (dag_run.conf or {}).get("route") == "high": task_instance.queue = "high_priority_queue" Backward compatibility is preserved through the local-settings plugin shim. Pluggy passes a hookimpl only the parameters it declares without a default, so this commit also makes make_plugin_from_local_settings register a function as-is when its parameters are a subset of the hookspec's, and shim it (forwarding the call positionally) when it renames a parameter or gives a hookspec parameter a default value. As a result every signature keeps working: the legacy single-argument hook, an explicit (task_instance, dag_run) hook, and the ergonomic (task_instance, dag_run=None) hook all behave correctly; a hook declaring an unknown parameter is still rejected. The dag_run may be None during early task-instance construction (when the hook is re-applied from refresh_from_task before the instance is bound to a run), and the hook must not open a new session; both are documented on the hookspec and in the cluster-policies guide, which also corrects the prior claim that the hook runs on the worker. Report URL: https://github.com/apache/airflow/actions/runs/27116292979 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
