kaxil commented on issue #56271: URL: https://github.com/apache/airflow/issues/56271#issuecomment-3356792806
@XD-DENG Could you possibly try using `airflow.models.dag.DAG` in Airflow 3.0.3 -- my hypothesis is it will fail with the same error. In 3.0.3, there were **two** DAG classes: 1. `airflow.models.dag.DAG` (legacy) - had `validate_executor_field()` in its `validate()` method ⚠️ 2. `airflow.sdk.DAG` (recommended) - **did NOT have** executor validation ✅ The SDK DAG's `validate()` method did NOT check executors, so worker pods could parse DAGs without knowing about all executors. **However**, if someone used the legacy import in 3.0.3: ```python from airflow.models import DAG # <-- Legacy DAG with executor validation ``` They **would have hit the same issue** (I think) in 3.0.3! This was a latent bug. ## What Changed in 3.1.0 PR #54383 ([commit f620bcc40a](https://github.com/apache/airflow/commit/f620bcc40a69330ca0a8b47c77c3d699e6136606)) removed `airflow.models.dag.DAG` entirely. Now only `airflow.sdk.DAG` exists. Since SDK DAG doesn't have executor validation, a **new standalone function** `_validate_executor_fields()` was added/ported over and is now called for **all** DAGs during parsing: https://github.com/apache/airflow/blob/3.1.0/airflow-core/src/airflow/models/dagbag.py#L149-L160 ```python def _process_modules(self, filepath, mods, file_last_changed_on_disk): from airflow.sdk import DAG # Only SDK DAG exists now # ... try: dag.validate() _validate_executor_fields(dag) # <-- NEW: validates ALL DAGs now self.bag_dag(dag=dag) ``` -- 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]
