eladm-scytale opened a new issue, #61945:
URL: https://github.com/apache/airflow/issues/61945
### Apache Airflow version
2.11.X
### If "Other Airflow 3 version" selected, which one?
_No response_
### What happened?
### Apache Airflow version
2.11.x
### What happened
The `task_instance_mutation_hook` defined in `airflow_local_settings.py` is
registered correctly with `POLICY_PLUGIN_MANAGER` (confirmed via startup logs),
but the hook function is **never invoked** when tasks are scheduled.
### What you think should happen instead?
The hook should be called for each task instance before scheduling, allowing
modifications to `pool` and other properties.
### How to reproduce
1. Create `$AIRFLOW_HOME/config/airflow_local_settings.py`:
```python
def task_instance_mutation_hook(task_instance):
print(f"HOOK CALLED: task={task_instance.task_id}")
# Modify pool for manual runs
run_id = getattr(task_instance, 'run_id', '')
if run_id.startswith('manual__'):
task_instance.pool = "high_priority_pool"
print("airflow_local_settings loaded")
```
2.Trigger any DAG manually: airflow dags trigger <dag_id>
3.Expected: Logs show "HOOK CALLED: task=..."
Actual: Hook is never called, no log output
Additional attempts (all failed)
Plugin with @hookimpl decorator and explicit POLICY_PLUGIN_MANAGER.register()
Monkey-patching airflow.settings and airflow.models.taskinstance
All approaches show successful registration but the hook is never invoked.
### Operating System
macOS/Linux
### Versions of Apache Airflow Providers
N/A - core issue
### Deployment
Docker-Compose
### Deployment details
Docker Compose with CeleryExecutor
### Anything else?
_No response_
### Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]