-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TDL-6148: Catch and retry Attribute error and TDL-13267: Fix AdCreative requests that are not retrying #171
TDL-6148: Catch and retry Attribute error and TDL-13267: Fix AdCreative requests that are not retrying #171
Conversation
tap_facebook/__init__.py
Outdated
@@ -153,6 +153,8 @@ def should_retry_api_error(exception): | |||
return True | |||
elif isinstance(exception, TypeError) and str(exception) == "string indices must be integers": | |||
return True | |||
elif isinstance(exception, AttributeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add it in the or of if isinstance(exception, FacebookBadObjectError)
, instead of adding a new elif.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates as per suggestion.
@@ -0,0 +1,154 @@ | |||
import unittest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@savan-chovatiya What is the difference between the test cases written in this file and test_attribute_error_retry.py
file.
In the above file as well, you are checking that call_count should be 5 times. What else you are checking in test_sync_batches_retry
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was no backoff on the sync_batches
function so I added and also include the FacebookRequestError
error with AttributeError
error so those tests are under test_sync_batches_retry
. While other test cases for AttributeError
are under 'test_attribute_error_retry.py'
with self.assertRaises(AttributeError): | ||
ad_creative_object.sync_batches([]) | ||
|
||
# verify calls inside sync_batches are called 5 times as max 5 reties provided for function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: It should be 'retries'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the typo.
@savan-chovatiya Please add comments to which code change corresponds to which JIRA |
@@ -241,6 +241,7 @@ class AdCreative(Stream): | |||
doc: https://developers.facebook.com/docs/marketing-api/reference/adgroup/adcreatives/ | |||
''' | |||
|
|||
@retry_pattern(backoff.expo, (FacebookRequestError, AttributeError), max_tries=5, factor=5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is for TDL-13267: AdCreative requests that are not retrying on AttributeError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These test cases needs to be reviewed by Kyle speer. Please assign this PR to him
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Change comments in the code
Added comments for changes in code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion
# verify get_ad_creatives() is called 5 times as max 5 reties provided for function | ||
self.assertEquals(mocked_account.get_ad_creatives.call_count, 5) | ||
|
||
def test__call_get_ads(self, mocked_sleep): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test__call_get_ads(self, mocked_sleep): | |
def test_call_get_ads(self, mocked_sleep): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated test name as per suggestion.
…r replication key field `date_start` (#172) * added format as date-time in schema file * added code coverage * added check for date format in the bookmark test * added the check for first sync messages Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com>
…streams and TDL-9872: replication keys are not specified as expected in discoverable metadata (#167) * added valid replication keys in catalog * modified the code * TDL-9809: Added replication keys in metadata * adde code coverage * Resolved review comments Co-authored-by: harshpatel4_crest <harsh.patel4@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com>
#168) * TDL-7455: Added archived data integration test * TDL-7455: Updated integration test * added code coverage * Resolved review comment Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com>
…ve requests that are not retrying (singer-io#171) * TDL-6148: Added retry for Attribute error of sync batches * TDL-6148: Removed unused imports from unit tests * TDL-13267: Added retry for 500 error of AdCreatives * TDL-6148: Add AttributeError backoff for all sync functions * added code coverage * Resolved review comment * Resolved review comments * Added code comments * Resolved review comment * TDL-9728: Stream `ads_insights_age_gender` has unexpected datatype for replication key field `date_start` (singer-io#172) * added format as date-time in schema file * added code coverage * added check for date format in the bookmark test * added the check for first sync messages Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-9809: `forced-replication-method` missing from metadata for some streams and TDL-9872: replication keys are not specified as expected in discoverable metadata (singer-io#167) * added valid replication keys in catalog * modified the code * TDL-9809: Added replication keys in metadata * adde code coverage * Resolved review comments Co-authored-by: harshpatel4_crest <harsh.patel4@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> * TDL-7455: Add tap-tester test to verify replication of deleted records (singer-io#168) * TDL-7455: Added archived data integration test * TDL-7455: Updated integration test * added code coverage * Resolved review comment Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com> Co-authored-by: Harsh <80324346+harshpatel4crest@users.noreply.github.com> Co-authored-by: harshpatel4_crest <harsh.patel4@crestdatasys.com> Co-authored-by: KrisPersonal <66801357+KrisPersonal@users.noreply.github.com>
Description of change
TDL-6148: catch and retry 'AttributeError: 'str' object has no attribute 'get''
TDL-13267: AdCreative requests that are not retrying
Manual QA steps
Risks
Rollback steps