jason810496 opened a new pull request, #77771: URL: https://github.com/apache/airflow/pull/77771
These ADRs set the design of callbacks, deadline alerts and listeners for Dags written with the TypeScript, Go and Java SDKs, and the core changes they need. They build on the Python sidecar and the `python` module from #77582. - [Core ADR-0020](https://github.com/jason810496/airflow/blob/feature/lang-sdk/callbacks-listeners-adr/airflow-core/adr/lang-sdk/0020-callbacks-deadline-alerts-and-listeners-across-lang-sdks.md): the contract every SDK shares, the schemas, the flows and the core changes. - [TypeScript ADR-0006](https://github.com/jason810496/airflow/blob/feature/lang-sdk/callbacks-listeners-adr/ts-sdk/adr/0006-callbacks-and-deadline-alerts-authoring-interface.md), [Go ADR-0011](https://github.com/jason810496/airflow/blob/feature/lang-sdk/callbacks-listeners-adr/go-sdk/adr/0011-callbacks-and-deadline-alerts-authoring-interface.md) and [Java ADR-0005](https://github.com/jason810496/airflow/blob/feature/lang-sdk/callbacks-listeners-adr/java-sdk/adr/0005-callbacks-and-deadline-alerts-authoring-interface.md): each SDK's authoring API, with examples. Decisions: - A callback is an SDK function or a Python reference (`python.callbackRef(path, kwargs)`). The runtime runs a task's callbacks when the task ends, within `[core] task_success_overtime`. The Python sidecar runs Python references, so no user code runs in the supervisor. - Callbacks for interrupted tasks, Dag runs, deadline alerts and emails go through a new `execute_callback` on the coordinator. Each request gets its own startup message, and the runtime picks the callables by state. - A stub TaskHandler's callbacks, emails and listener hooks run in the Python sidecar, which loads the Python Dag. - A deadline alert takes a built-in reference or `python.deadlineReferenceRef(path, kwargs)`. Its callback can be an SDK function, a sync Python reference or an async Python reference. - Listeners stay Python. The supervisor fires the task instance hooks in the Python sidecar. - Failure and retry emails go through the Python sidecar with the `[email]` backend. Core changes: - New supervisor messages: dedicated callback startup schemas, `TaskStarted`, `RunPythonCallback`, `RunStubTaskStartHooks`, `RunStubTaskEndHooks`, `SendFailureEmail` and `SendRetryEmail`. - The scheduler routes a Lang SDK Dag's callbacks by the task's queue and executor. - After a final state, the supervisor ignores the runtime's exit code, and `TaskState` and `RetryTask` gain an optional `error`. - A new `DeadlineAlertCallback` with the `deadline_alert` fetch method, and a deadline variant of the callback context endpoint. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Claude Code (Opus 5.5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
