Lee-W commented on code in PR #72149:
URL: https://github.com/apache/airflow/pull/72149#discussion_r4090999790
##########
providers/openai/src/airflow/providers/openai/hooks/openai.py:
##########
@@ -95,6 +96,29 @@ def is_in_progress(cls, status: str) -> bool:
#: Statuses the provider's trigger emits in its terminal event.
TRIGGER_EVENT_STATUSES = frozenset({"success", "error", "cancelled"})
+# Maps the trigger's ``termination_reason`` field to the exception
``execute_complete``
+# should raise. Keyed on the reason field, never on the message text, so that a
+# rewording of the trigger's message never silently changes which exception a
+# downstream task can catch.
+_TERMINATION_REASON_EXCEPTIONS: dict[str, type[AirflowException]] = {
+ "timeout": OpenAIBatchTimeout,
Review Comment:
Added a `TerminationReason` str enum.
The trigger emits it, and the exception map and the operator's timeout check
both key on it, so a misspelled reason is now an attribute error.
--
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]