This is an automated email from the ASF dual-hosted git repository.

vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8637df49fcb Increase Comprehend document classifier timeout from 20 to 
60 minutes (#71969)
8637df49fcb is described below

commit 8637df49fcb4a775422e14fc1fbee3a7ef62fc0e
Author: Ramit Kataria <[email protected]>
AuthorDate: Wed Aug 26 06:52:06 2026 -0700

    Increase Comprehend document classifier timeout from 20 to 60 minutes 
(#71969)
    
    Classifier training sometimes takes longer than 20 minutes, but the
    operator's default waiter budget was 20 x 60s in both sync and deferrable
    paths, so those runs failed with a waiter timeout. Raise the cap to
    60 x 60s: the companion sensor and trigger allow 150 minutes, but that is
    too large a jump for the operator's implicit wait, so they are left
    unchanged. This also lets the system test Dag drop its
    wait_for_completion=False workaround, so the test exercises the operator's
    default wait path. A changelog warning documents the longer default wait.
---
 providers/amazon/docs/changelog.rst                               | 8 ++++++++
 .../src/airflow/providers/amazon/aws/operators/comprehend.py      | 4 ++--
 .../system/amazon/aws/example_comprehend_document_classifier.py   | 1 -
 .../amazon/tests/unit/amazon/aws/operators/test_comprehend.py     | 2 ++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/providers/amazon/docs/changelog.rst 
b/providers/amazon/docs/changelog.rst
index d7e44bbe5de..ca7ffc5acaa 100644
--- a/providers/amazon/docs/changelog.rst
+++ b/providers/amazon/docs/changelog.rst
@@ -26,6 +26,14 @@
 Changelog
 ---------
 
+.. warning::
+  The default waiter timeout of ``ComprehendCreateDocumentClassifierOperator`` 
was raised from
+  20 minutes (``waiter_max_attempts=20``) to 60 minutes 
(``waiter_max_attempts=60``), because
+  document classifier training sometimes takes longer than 20 minutes. When 
the operator waits
+  for completion (the default, in both synchronous and deferrable mode), tasks 
that previously
+  failed with a waiter timeout around the 20-minute mark now keep waiting for 
up to an hour.
+  Pass ``waiter_max_attempts`` explicitly to restore the previous timeout.
+
 9.35.1
 ......
 
diff --git 
a/providers/amazon/src/airflow/providers/amazon/aws/operators/comprehend.py 
b/providers/amazon/src/airflow/providers/amazon/aws/operators/comprehend.py
index 575263eb0f6..cdc3a30bf9e 100644
--- a/providers/amazon/src/airflow/providers/amazon/aws/operators/comprehend.py
+++ b/providers/amazon/src/airflow/providers/amazon/aws/operators/comprehend.py
@@ -238,7 +238,7 @@ class 
ComprehendCreateDocumentClassifierOperator(AwsBaseOperator[ComprehendHook]
 
     :param wait_for_completion: Whether to wait for job to stop. (default: 
True)
     :param waiter_delay: Time in seconds to wait between status checks. 
(default: 60)
-    :param waiter_max_attempts: Maximum number of attempts to check for job 
completion. (default: 20)
+    :param waiter_max_attempts: Maximum number of attempts to check for job 
completion. (default: 60)
     :param deferrable: If True, the operator will wait asynchronously for the 
job to stop.
         This implies waiting for completion. This mode requires aiobotocore 
module to be installed.
         (default: False)
@@ -285,7 +285,7 @@ class 
ComprehendCreateDocumentClassifierOperator(AwsBaseOperator[ComprehendHook]
         document_classifier_kwargs: dict[str, Any] | None = None,
         wait_for_completion: bool = True,
         waiter_delay: int = 60,
-        waiter_max_attempts: int = 20,
+        waiter_max_attempts: int = 60,
         deferrable: bool = conf.getboolean("operators", "default_deferrable", 
fallback=False),
         **kwargs,
     ):
diff --git 
a/providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py
 
b/providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py
index 748db647eec..7b32eae9615 100644
--- 
a/providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py
+++ 
b/providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py
@@ -106,7 +106,6 @@ def document_classifier_workflow():
         document_classifier_kwargs=document_classifier_kwargs,
     )
     # [END howto_operator_create_document_classifier]
-    create_document_classifier.wait_for_completion = False
 
     # [START howto_sensor_create_document_classifier]
     await_create_document_classifier = 
ComprehendCreateDocumentClassifierCompletedSensor(
diff --git 
a/providers/amazon/tests/unit/amazon/aws/operators/test_comprehend.py 
b/providers/amazon/tests/unit/amazon/aws/operators/test_comprehend.py
index fea16411a29..c9ed74b9e5d 100644
--- a/providers/amazon/tests/unit/amazon/aws/operators/test_comprehend.py
+++ b/providers/amazon/tests/unit/amazon/aws/operators/test_comprehend.py
@@ -243,6 +243,8 @@ class TestComprehendCreateDocumentClassifierOperator:
         assert self.operator.language_code == "en"
         assert self.operator.document_classifier_kwargs == {"VersionName": 
"v1"}
         assert self.operator.fail_on_warnings is False
+        assert self.operator.waiter_delay == 60
+        assert self.operator.waiter_max_attempts == 60
 
     @mock.patch.object(ComprehendHook, "conn")
     def test_create_document_classifier(self, mock_conn):

Reply via email to