Skip to content

Commit

Permalink
Changed the show_data function (#138)
Browse files Browse the repository at this point in the history
* Changed the show_data function

* Added Endpoint_collection_node variable

* Improved naming convention in show_data function
  • Loading branch information
vedangj044 authored May 14, 2020
1 parent 38eb877 commit f804b0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
32 changes: 9 additions & 23 deletions hydra_agent/querying_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,16 @@ def show_data(self, get_data):
Count is using for avoid stuffs like query internal execution time.
:param get_data: data get from the Redis memory.
"""
count = 0
all_property_lists = []
all_property_lists = ""
for objects in get_data:
count += 1
# Show data only for odd value of count.
# because for even value it contains stuffs like time and etc.
# ex: Redis provide data like if we query class endpoint
# output like:
# [[endpoints in byte object form],[query execution time:0.5ms]]
# So with the help of count, byte object convert to string
# and also show only useful strings not the query execution time.
if count % 2 != 0:
for obj1 in objects:
for obj in obj1:
if obj is None:
continue
string = obj.decode('utf-8')
map_string = map(str.strip, string.split(','))
property_list = list(map_string)
check = property_list.pop()
property_list.append(check.replace("\x00", ""))
if property_list[0] != "NULL":
# print(property_list)
all_property_lists.append(property_list)
try:
if isinstance(objects[0], list):
for object_data in objects:
all_property_lists+=(str(object_data)+"\n")
else:
all_property_lists+=(str(objects[0])+"\n")
except Exception as e:
all_property_lists+=(str(objects)+"\n")
return all_property_lists


Expand Down
2 changes: 2 additions & 0 deletions hydra_agent/redis_core/collections_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def load_from_server(
url + "/" +
endpoint)
new_url = url + "/" + endpoint

endpoint_collection_node = ""
# url for every collection endpoint
new_file = self.fetch_data(new_url)
if isinstance(new_file, RequestError):
Expand Down

0 comments on commit f804b0a

Please sign in to comment.