Example #1
0
 def latest_metadata(self):
     client = self.cluster.get_pydruid_client()
     results = client.time_boundary(datasource=self.datasource_name)
     max_time = results[0]['result']['minTime']
     max_time = parse(max_time)
     intervals = (max_time - timedelta(seconds=1)).isoformat() + '/'
     intervals += (max_time + timedelta(seconds=1)).isoformat()
     segment_metadata = client.segment_metadata(
         datasource=self.datasource_name, intervals=intervals)
     if segment_metadata:
         return segment_metadata[-1]['columns']
Example #2
0
 def latest_metadata(self):
     client = self.cluster.get_pydruid_client()
     results = client.time_boundary(datasource=self.datasource_name)
     if not results:
         return
     max_time = results[0]['result']['minTime']
     max_time = parse(max_time)
     intervals = (max_time - timedelta(seconds=1)).isoformat() + '/'
     intervals += (max_time + timedelta(seconds=1)).isoformat()
     segment_metadata = client.segment_metadata(
         datasource=self.datasource_name,
         intervals=intervals)
     if segment_metadata:
         return segment_metadata[-1]['columns']
Example #3
0
 def latest_metadata(self):
     """Returns segment metadata from the latest segment"""
     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 = parse(max_time)
     # 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 trigged a bug (fixed in druid 0.8.2).
     # https://groups.google.com/forum/#!topic/druid-user/gVCqqspHqOQ
     intervals = (max_time - timedelta(days=7)).isoformat() + '/'
     intervals += (max_time - timedelta(days=1)).isoformat()
     segment_metadata = client.segment_metadata(
         datasource=self.datasource_name, intervals=intervals)
     if segment_metadata:
         return segment_metadata[-1]['columns']
Example #4
0
 def latest_metadata(self):
     """Returns segment metadata from the latest segment"""
     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 = parse(max_time)
     # 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 trigged a bug (fixed in druid 0.8.2).
     # https://groups.google.com/forum/#!topic/druid-user/gVCqqspHqOQ
     intervals = (max_time - timedelta(days=7)).isoformat() + '/'
     intervals += (max_time - timedelta(days=1)).isoformat()
     segment_metadata = client.segment_metadata(
         datasource=self.datasource_name,
         intervals=intervals)
     if segment_metadata:
         return segment_metadata[-1]['columns']