You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving callbacks to workers as a separate activity.
Running callbacks as teardown task.
Deprecate (not remove) concept of callback and pushing users to use teardown. If we do this and deprecate/not remove this option will happen with one of the above two options.
Leave them in dag-processor
I am leaning towards (2) — and (3) is my next preference. This is because imo callbacks and teardowns are sort of redundant concepts, and if we keep them as is, we will have an explosion of callbacks, we already have: on_{success,failure,skipped,retry,execute}_callback .
The (2) sounds like a really good idea (not for all callbacks though). It would be great to see callbacks as implicit "tasks" in Airflow UI. Though not all callbacks can be done this way I am afraid. "on_retry" and "on execute" are particularly not fitting the "teardown" concept. The "on_execute" might be an implicit "setup" task, but "on_retry" is a bit problematic
we need to consider what happens when task succeeded but callback wasn't. We need retry for callbacks but if for example worker is terminated between task success to callback execution how would it retry?
Also on_sla_callback() and on_execute_callback() can't be part of teardown. We need to verify with AIP-86 what is the plan for sla callback as part of the deadline interface and if it conflicts with the plan we choose to take here cc @ferruzzi@romsharon98
The plan for Deadlines is to add a simple check in the scheduler loop, essentially (obviously pseudocode): if (select min(deadline) from DeadlinesTable) < utcnow(): handle_deadline_misses() My intention was for the handler to spin up a new process to run the callbacks so it isn't holding anything else up, but let me know if that plan needs to change with this initiative.
Should there be a timeout for task callbacks (like on_success_callback) in case they hang (e.g., due to API delays or infinite loops), so they don't block task completion?
Something similar to execution_timeout, but specifically for callbacks.
This could help avoid issues where long or broken callbacks prevent task success from being registered.
WDYT?
I managed to hit this for reasons I'm unclear about under 3.0.2.
It was being raised by the DAG Processor after parsing a dag file that generates 27 DAGs from a config file (time python on the file reports sub-second runtime). I could see an error pointing me here from airflow-core/src/airflow/dag_processing/processor.py
Unfortunately this was causing all the DAGs that file generated to be dropped which was, regrettably, all of them.
After turning on debugging and much poking about I found this in the DAG processing log for the file:
So the DAG processor was creating a TaskCallbackRequest for running backfill task? After shutting off all the backfills killing the task the processor worked again happily but I'm concerned I can't use backfill without triggering this as it's not clear why it happened.
--- Supervised process Last chance exception handler ---
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 376, in _fork_main
target()
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 126, in _parse_file_entrypoint
result = _parse_file(msg, log)
^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 142, in _parse_file
_execute_callbacks(bag, msg.callback_requests, log)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 182, in _execute_callbacks
raise NotImplementedError(
NotImplementedError: Haven't coded Task callback yet - #44354!
I have the same problem. Will updating fix it? I'm currently using helm chart 1.18.0 with airflow 3.0.2. Will chart 1.19.0-dev with appVersion: 3.1.3 fix the problem?
Activity
potiuk commentedon Nov 26, 2024
The (2) sounds like a really good idea (not for all callbacks though). It would be great to see callbacks as implicit "tasks" in Airflow UI. Though not all callbacks can be done this way I am afraid. "on_retry" and "on execute" are particularly not fitting the "teardown" concept. The "on_execute" might be an implicit "setup" task, but "on_retry" is a bit problematic
eladkal commentedon Dec 1, 2024
we need to consider what happens when task succeeded but callback wasn't. We need retry for callbacks but if for example worker is terminated between task success to callback execution how would it retry?
Also
on_sla_callback()andon_execute_callback()can't be part of teardown. We need to verify with AIP-86 what is the plan for sla callback as part of the deadline interface and if it conflicts with the plan we choose to take here cc @ferruzzi @romsharon98ferruzzi commentedon Dec 3, 2024
The plan for Deadlines is to add a simple check in the scheduler loop, essentially (obviously pseudocode):
if (select min(deadline) from DeadlinesTable) < utcnow(): handle_deadline_misses()My intention was for the handler to spin up a new process to run the callbacks so it isn't holding anything else up, but let me know if that plan needs to change with this initiative.[-]Move callbacks to worker[/-][+]Move dag-level callbacks to worker[/+]VladaZakharova commentedon May 6, 2025
Should there be a timeout for task callbacks (like on_success_callback) in case they hang (e.g., due to API delays or infinite loops), so they don't block task completion?
Something similar to execution_timeout, but specifically for callbacks.
This could help avoid issues where long or broken callbacks prevent task success from being registered.
WDYT?
Update callbacks.rst
baylisscg commentedon Jul 2, 2025
I managed to hit this for reasons I'm unclear about under 3.0.2.
It was being raised by the DAG Processor after parsing a dag file that generates 27 DAGs from a config file (
time pythonon the file reports sub-second runtime). I could see an error pointing me here from airflow-core/src/airflow/dag_processing/processor.pyUnfortunately this was causing all the DAGs that file generated to be dropped which was, regrettably, all of them.
After turning on debugging and much poking about I found this in the DAG processing log for the file:
{ "timestamp": "2025-07-01T00:00:10.108010", "level": "debug", "event": "Processing Callback Request", "request": "{\"filepath\":\"extract.py\",\"bundle_name\":\"dags-folder\",\"bundle_version\":null,\"msg\":\"{'DAG Id': '#####', 'Task Id': '#####', 'Run Id': 'backfill__2024-12-12T00:00:00+00:00', 'Map Index': 2, 'Hostname': 'f3d38ea38a99', 'External Executor Id': '15bbb640-d659-44be-a26b-7bc2030b4b4e'}\",\"ti\":{\"id\":\"0197aefa-80b8-73cd-a588-17b61f373a76\",\"task_id\":\"'#####',\",\"dag_id\":\"'#####',\",\"run_id\":\"backfill__2024-12-12T00:00:00+00:00\",\"try_number\":1,\"map_index\":2,\"hostname\":\"f3d38ea38a99\",\"context_carrier\":{}},\"task_callback_type\":null,\"type\":\"TaskCallbackRequest\"}", "logger": "task" }So the DAG processor was creating a
TaskCallbackRequestfor running backfill task? After shutting off all the backfills killing the task the processor worked again happily but I'm concerned I can't use backfill without triggering this as it's not clear why it happened.19 remaining items
ramitkataria commentedon Oct 21, 2025
I believe option 1 should be relatively straightforward to implement once support for
ExecuteCallbackis added to workers, which is in progressairflow/airflow-core/src/airflow/executors/workloads.py
Line 146 in 25202a8
Run Task failure callbacks on DAG Processor when task is externally k…
xkarkosx commentedon Dec 10, 2025
--- Supervised process Last chance exception handler ---
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 376, in _fork_main
target()
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 126, in _parse_file_entrypoint
result = _parse_file(msg, log)
^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 142, in _parse_file
_execute_callbacks(bag, msg.callback_requests, log)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/dag_processing/processor.py", line 182, in _execute_callbacks
raise NotImplementedError(
NotImplementedError: Haven't coded Task callback yet - #44354!
I have the same problem. Will updating fix it? I'm currently using helm chart 1.18.0 with airflow 3.0.2. Will chart 1.19.0-dev with appVersion: 3.1.3 fix the problem?
task-sdkdependency fromairflow-core#62061Run Task failure callbacks on DAG Processor when task is externally k…
Run Task failure callbacks on DAG Processor when task is externally k…
Run Task failure callbacks on DAG Processor when task is externally k…
Run Task failure callbacks on DAG Processor when task is externally k…