|
| 1 | +Move task-level exception imports into the Task SDK |
| 2 | + |
| 3 | +Airflow now sources task-facing exceptions (``AirflowSkipException``, ``TaskDeferred``, etc.) from |
| 4 | +``airflow.sdk.exceptions``. ``airflow.exceptions`` still exposes the same symbols, but they are |
| 5 | +proxies that emit ``DeprecatedImportWarning`` so Dag authors can migrate before the shim is removed. |
| 6 | + |
| 7 | +**What changed:** |
| 8 | + |
| 9 | +- Runtime code now consistently raises the SDK versions of task-level exceptions. |
| 10 | +- The Task SDK redefines these classes so workers no longer depend on ``airflow-core`` at runtime. |
| 11 | +- ``airflow.providers.common.compat.sdk`` centralizes compatibility imports for providers. |
| 12 | + |
| 13 | +**Behaviour changes:** |
| 14 | + |
| 15 | +- Sensors and other helpers that validate user input now raise ``ValueError`` (instead of |
| 16 | + ``AirflowException``) when ``poke_interval``/ ``timeout`` arguments are invalid. |
| 17 | +- Importing deprecated exception names from ``airflow.exceptions`` logs a warning directing users to |
| 18 | + the SDK import path. |
| 19 | + |
| 20 | +**Exceptions now provided by ``airflow.sdk.exceptions``:** |
| 21 | + |
| 22 | +- ``AirflowException`` and ``AirflowNotFoundException`` |
| 23 | +- ``AirflowRescheduleException`` and ``AirflowSensorTimeout`` |
| 24 | +- ``AirflowSkipException``, ``AirflowFailException``, ``AirflowTaskTimeout``, ``AirflowTaskTerminated`` |
| 25 | +- ``TaskDeferred``, ``TaskDeferralTimeout``, ``TaskDeferralError`` |
| 26 | +- ``DagRunTriggerException`` and ``DownstreamTasksSkipped`` |
| 27 | +- ``AirflowDagCycleException`` and ``AirflowInactiveAssetInInletOrOutletException`` |
| 28 | +- ``ParamValidationError``, ``DuplicateTaskIdFound``, ``TaskAlreadyInTaskGroup``, ``TaskNotFound``, ``XComNotFound`` |
| 29 | + |
| 30 | +**Backwards compatibility:** |
| 31 | + |
| 32 | +- Existing Dags/operators that still import from ``airflow.exceptions`` continue to work, though |
| 33 | + they log warnings. |
| 34 | +- Providers can rely on ``airflow.providers.common.compat.sdk`` to keep one import path that works |
| 35 | + across supported Airflow versions. |
| 36 | + |
| 37 | +**Migration:** |
| 38 | + |
| 39 | +- Update custom operators, sensors, and extensions to import exception classes from |
| 40 | + ``airflow.sdk.exceptions`` (or from the provider compat shim). |
| 41 | +- Adjust custom validation code to expect ``ValueError`` for invalid sensor arguments if it |
| 42 | + previously caught ``AirflowException``. |
| 43 | + |
| 44 | +* Types of change |
| 45 | + |
| 46 | + * [ ] Dag changes |
| 47 | + * [ ] Config changes |
| 48 | + * [ ] API changes |
| 49 | + * [ ] CLI changes |
| 50 | + * [x] Behaviour changes |
| 51 | + * [ ] Plugin changes |
| 52 | + * [ ] Dependency changes |
| 53 | + * [x] Code interface changes |
| 54 | + |
| 55 | +* Migration rules needed |
| 56 | + |
| 57 | + * Import task-level exceptions such as ``AirflowSkipException``, ``TaskDeferred``, |
| 58 | + ``AirflowFailException``, etc. from ``airflow.sdk.exceptions`` instead of ``airflow.exceptions``. |
| 59 | + * Update custom sensors/operators that validated arguments by catching ``AirflowException`` to |
| 60 | + expect ``ValueError`` for invalid ``poke_interval`` / ``timeout`` inputs. |
0 commit comments