Lee-W commented on code in PR #72149:
URL: https://github.com/apache/airflow/pull/72149#discussion_r4130282775


##########
providers/openai/src/airflow/providers/openai/operators/openai.py:
##########
@@ -361,8 +365,16 @@ class OpenAITriggerBatchOperator(BaseOperator):
     :param wait_seconds: Optional. Number of seconds between checks. Only used 
when ``deferrable`` is False.
         Defaults to 3 seconds.
     :param timeout: Optional. The amount of time, in seconds, to wait for the 
request to complete.
-        Applies in both deferrable and non-deferrable mode. Defaults to 24 
hours, which is the SLA for
-        OpenAI Batch API.
+        Applies in both deferrable and non-deferrable mode: in the synchronous 
path it bounds
+        ``wait_for_batch``; in the deferrable path it bounds the trigger's 
poll loop. When the
+        deferrable path times out, the operator requests cancellation of the 
batch using the
+        batch id carried by the trigger event, mirroring the synchronous path. 
Cancellation on
+        OpenAI's side is asynchronous — the batch reports ``cancelling`` for 
up to 10 minutes
+        before it settles as ``cancelled`` — so this only *requests* 
cancellation, it does not
+        wait for it. If ``execution_timeout`` is set shorter than ``timeout``, 
the scheduler's
+        deferral timeout fires first: the task is failed with 
``TaskDeferralTimeout`` before the
+        trigger ever times out, ``execute_complete`` is never called, and this 
cancellation path
+        does not run. Defaults to 24 hours, which is the SLA for OpenAI Batch 
API.

Review Comment:
   `:param timeout:` is back to its meaning plus the `execution_timeout` 
caveat, now scoped to deferrable mode (in sync mode `on_kill` does cancel). The 
reason-to-exception mapping lives only in `execute_complete`, and the 10-minute 
caveat only in `_cancel_batch_quietly`.



-- 
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]

Reply via email to