Skip to content

Commit

Permalink
Improve insights error message (#20)
Browse files Browse the repository at this point in the history
* version bump

* more descriptive error message

* update pylint config
  • Loading branch information
karstendick committed Sep 18, 2017
1 parent 25264ad commit 0d84acf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies:

test:
post:
- pylint tap_facebook -d missing-docstring,too-few-public-methods,too-many-arguments,locally-disabled
- pylint tap_facebook -d C,R,W
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name='tap-facebook',
version='1.0.3',
version='1.0.4',
description='Singer.io tap for extracting data from the Facebook Ads API',
author='Stitch',
url='https://singer.io',
Expand Down
8 changes: 5 additions & 3 deletions tap_facebook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,11 @@ def run_job(self, params):
'Insights job {} did not start after {} seconds'.format(
job_id, INSIGHTS_MAX_WAIT_TO_START_SECONDS))
elif duration > INSIGHTS_MAX_WAIT_TO_FINISH_SECONDS and status != "Job Completed":
raise Exception(
'Insights job {} did not complete after {} seconds'.format(
job_id, INSIGHTS_MAX_WAIT_TO_FINISH_SECONDS))
pretty_error_message = ('Insights job {} did not complete after {} minutes. ' +
'This is an intermittent error and may resolve itself on subsequent queries to the Facebook API. ' +
'You should deselect fields from the schema that are not necessary, ' +
'as that may help improve the reliability of the Facebook API.')
raise Exception(pretty_error_message.format(job_id, INSIGHTS_MAX_WAIT_TO_FINISH_SECONDS//60))
LOGGER.info("sleeping for %d seconds until job is done", sleep_time)
time.sleep(sleep_time)
if sleep_time < INSIGHTS_MAX_ASYNC_SLEEP_SECONDS:
Expand Down

0 comments on commit 0d84acf

Please sign in to comment.