dejii commented on issue #54804: URL: https://github.com/apache/airflow/issues/54804#issuecomment-3368644951
I believe triggers should raise exceptions rather than catch and yield error events. This allows the triggerer framework to handle failures appropriately for different use cases: - Deferred tasks: Task fails gracefully raising a `TaskDeferralError` https://github.com/apache/airflow/blob/3a93f9b075b55fc3f657288e140cbdf46d92c56d/task-sdk/src/airflow/sdk/bases/operator.py#L1622-L1629 https://github.com/apache/airflow/blob/3a93f9b075b55fc3f657288e140cbdf46d92c56d/airflow-core/src/airflow/models/trigger.py#L289-L298 - Asset watchers: Trigger stops without creating asset events or scheduling DAG runs. Same pattern of not yielding `TriggerEvent` can be observed in [SqsSensorTrigger](https://github.com/apache/airflow/blob/3a93f9b075b55fc3f657288e140cbdf46d92c56d/providers/amazon/src/airflow/providers/amazon/aws/triggers/sqs.py#L219) and [AwaitMessageTrigger](https://github.com/apache/airflow/blob/3a93f9b075b55fc3f657288e140cbdf46d92c56d/providers/redis/src/airflow/providers/redis/triggers/redis_await_message.py#L66), which are also used as message queues. I've fixed it for `PubsubPullTrigger` in https://github.com/apache/airflow/pull/54494 > When a child of the BaseEventTrigger class returns a TriggerEvent with "status": "error", an AssetEvent should not be created To achieve this, I think we would need a standardized message format for `TriggerEvent`, which currently doesn’t exist. Some triggers don’t include a `status` key in the event dictionary at all, and among those that do, the values are inconsistent—some use `error`, others use `failed` -- 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]
