Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the show_data function #138

Merged
merged 3 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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