"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cloudkitty/storage/v2/elasticsearch/client.py" between
cloudkitty-16.0.0.tar.gz and cloudkitty-17.0.0.tar.gz

About: OpenStack CloudKitty provides Rating-as-a-Service for OpenStack.
The "Zed" series (latest release).

client.py  (cloudkitty-16.0.0):client.py  (cloudkitty-17.0.0)
skipping to change at line 310 skipping to change at line 310
query = self._build_query( query = self._build_query(
self._build_must(begin, end, metric_types, filters), self._build_must(begin, end, metric_types, filters),
self._build_should(filters), None) self._build_should(filters), None)
query['size'] = self._get_chunk_size(offset, limit, paginate) query['size'] = self._get_chunk_size(offset, limit, paginate)
resp = self.search(query) resp = self.search(query)
scroll_id = resp['_scroll_id'] scroll_id = resp['_scroll_id']
self._scroll_ids.add(scroll_id) self._scroll_ids.add(scroll_id)
total = resp['hits']['total'] total_hits = resp['hits']['total']
if isinstance(total_hits, dict):
LOG.debug("Total hits [%s] is a dict. Therefore, we only extract "
"the 'value' attribute as the total option.", total_hits)
total_hits = total_hits.get("value")
total = total_hits
chunk = resp['hits']['hits'] chunk = resp['hits']['hits']
output = chunk[offset:offset+limit if paginate else len(chunk)] output = chunk[offset:offset+limit if paginate else len(chunk)]
offset = 0 if len(chunk) > offset else offset - len(chunk) offset = 0 if len(chunk) > offset else offset - len(chunk)
while (not paginate) or len(output) < limit: while (not paginate) or len(output) < limit:
resp = self.scroll({ resp = self.scroll({
'scroll_id': scroll_id, 'scroll_id': scroll_id,
'scroll': self._scroll_duration, 'scroll': self._scroll_duration,
}) })
 End of changes. 1 change blocks. 
1 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)