Skip to content

Commit

Permalink
[druid] Catch IOError when fetching Druid datasource time boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bodley committed Nov 18, 2017
1 parent fa35d7d commit eb8fed4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,15 @@ def latest_metadata(self):
"""Returns segment metadata from the latest segment"""
logging.info('Syncing datasource [{}]'.format(self.datasource_name))
client = self.cluster.get_pydruid_client()
results = client.time_boundary(datasource=self.datasource_name)
if not results:
return
max_time = results[0]['result']['maxTime']
max_time = dparse(max_time)
try:
results = client.time_boundary(datasource=self.datasource_name)
except IOError:
results = None
if results:
max_time = results[0]['result']['maxTime']
max_time = dparse(max_time)
else:
max_time = datetime.now()
# Query segmentMetadata for 7 days back. However, due to a bug,
# we need to set this interval to more than 1 day ago to exclude
# realtime segments, which triggered a bug (fixed in druid 0.8.2).
Expand Down

0 comments on commit eb8fed4

Please sign in to comment.