Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions rdl/data_sources/AWSLambdaDataSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pandas
import json
import boto3
import time

from rdl.data_sources.ChangeTrackingInfo import ChangeTrackingInfo
from rdl.data_sources.SourceTableInfo import SourceTableInfo
Expand Down Expand Up @@ -149,9 +150,14 @@ def __get_data_frame(self, data: [[]], column_names: []):

def __invoke_lambda(self, pay_load):
max_attempts = Constants.MAX_AWS_LAMBDA_INVOKATION_ATTEMPTS
retry_delay = Constants.AWS_LAMBDA_RETRY_DELAY_SECONDS
response_payload = None

for current_attempt in list(range(1, max_attempts+1, 1)):
if current_attempt > 1:
self.logger.debug(f"\nDelaying retry for {(current_attempt - 1) ^ retry_delay} seconds")
time.sleep((current_attempt - 1) ^ retry_delay)

self.logger.debug(f"\nRequest being sent to Lambda, attempt {current_attempt} of {max_attempts}:")
self.logger.debug(pay_load)

Expand Down
3 changes: 2 additions & 1 deletion rdl/shared/Constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
APP_NAME = "Relational Data Loader"
DATA_PIPELINE_EXECUTION_SCHEMA_NAME = "rdl"
MAX_AWS_LAMBDA_INVOKATION_ATTEMPTS = 3
MAX_AWS_LAMBDA_INVOKATION_ATTEMPTS = 4 # 1 + 3 retries
AWS_LAMBDA_RETRY_DELAY_SECONDS = 4 # 4 ^ retry attempt, so retry attempt 3 is delayed 64 seconds


class FullRefreshReason:
Expand Down