You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by on...@apache.org on 2023/05/26 19:26:33 UTC

[airflow] branch main updated: AWS system test example_dynamodb_to_s3: add logs when retry (#31571)

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

onikolas 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 e86f688045 AWS system test example_dynamodb_to_s3: add logs when retry (#31571)
e86f688045 is described below

commit e86f6880450764da85215a7dbb0406af5ffc8d1a
Author: Vincent <97...@users.noreply.github.com>
AuthorDate: Fri May 26 15:26:19 2023 -0400

    AWS system test example_dynamodb_to_s3: add logs when retry (#31571)
---
 tests/system/providers/amazon/aws/example_dynamodb_to_s3.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/system/providers/amazon/aws/example_dynamodb_to_s3.py b/tests/system/providers/amazon/aws/example_dynamodb_to_s3.py
index fb200194b4..048882cf64 100644
--- a/tests/system/providers/amazon/aws/example_dynamodb_to_s3.py
+++ b/tests/system/providers/amazon/aws/example_dynamodb_to_s3.py
@@ -16,10 +16,12 @@
 # under the License.
 from __future__ import annotations
 
+import logging
 from datetime import datetime
 
 import boto3
 import tenacity
+from tenacity import before_log, before_sleep_log
 
 from airflow.decorators import task
 from airflow.models.baseoperator import chain
@@ -29,6 +31,8 @@ from airflow.providers.amazon.aws.transfers.dynamodb_to_s3 import DynamoDBToS3Op
 from airflow.utils.trigger_rule import TriggerRule
 from tests.system.providers.amazon.aws.utils import ENV_ID_KEY, SystemTestContextBuilder
 
+log = logging.getLogger(__name__)
+
 DAG_ID = "example_dynamodb_to_s3"
 
 sys_test_context_task = SystemTestContextBuilder().build()
@@ -51,6 +55,8 @@ S3_KEY_PREFIX = "dynamodb-segmented-file"
 @tenacity.retry(
     stop=tenacity.stop_after_attempt(5),
     wait=tenacity.wait_exponential(min=5),
+    before=before_log(log, logging.INFO),
+    before_sleep=before_sleep_log(log, logging.WARNING),
 )
 def enable_point_in_time_recovery(table_name: str):
     boto3.client("dynamodb").update_continuous_backups(