Skip to content

Feature/retry insights job polling#174

Merged
dsprayberry merged 8 commits into
masterfrom
feature/retry-insights-job-polling
Nov 2, 2021
Merged

Feature/retry insights job polling#174
dsprayberry merged 8 commits into
masterfrom
feature/retry-insights-job-polling

Conversation

@dsprayberry

@dsprayberry dsprayberry commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

Description of change

Adds sleep and retry to job polling. Creates new tests for consistent failure / retry and failure / eventual success.

Manual QA steps

  • wrote script to reproduce failure scenario and exit upon successful retry
  • validated locally
  • new tests added

Risks

  • minimally extended job duration

Rollback steps

  • revert this branch

@dmosorast dmosorast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might need a bit of a redesign to get a proper retry pattern set up.

Comment thread tap_facebook/__init__.py Outdated
Comment thread tap_facebook/__init__.py Outdated
def api_get_with_retry(job):
job = job.api_get()
return job

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move this closer to usage inside the class and mark it "private" in the python sense by prefixing with __.

Pylint will probably warn about no self usage, but I think you can use @staticmethod to stop that. So like:

@staticmethod
@retry_pattern(backoff.constant, FacebookRequestError, max_tries=5, interval=1)
def __api_get_with_retry(job):
    job = job.api_get()
    return job

Then the usage would be

AdsInsights.__api_get_with_retry(job)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benefit of this is that it makes it clear that this is only for insights usage and to keep it localized for if we want to refactor the class into its own module.

@dsprayberry dsprayberry merged commit 10bad1c into master Nov 2, 2021
@dsprayberry dsprayberry deleted the feature/retry-insights-job-polling branch November 2, 2021 17:35
jesuejunior pushed a commit to sixcodes/tap-facebook that referenced this pull request Mar 17, 2023
* Add sleep and retry for insights job polling

* correct dylans typo

* added tests, got tests passing

* Makes api_get_with_retry function that uses retry wrapper

* Style changes

* Style changes 2

* Version Bump

* removed count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants