Skip to content

Commit

Permalink
Fix set_route handler in ldmsd Python module and interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nichamon authored and tom95858 committed Dec 10, 2024
1 parent 38fbac8 commit e266f7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ldms/python/ldmsd/ldmsd_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ def set_route(self, instance):
try:
req.send(self)
resp = req.receive(self)
return resp['errcode'], resp['attr_list']
return resp['errcode'], resp['msg']
except Exception as e:
return errno.ENOTCONN, str(e)

Expand Down
17 changes: 7 additions & 10 deletions ldms/python/ldmsd/ldmsd_controller
Original file line number Diff line number Diff line change
Expand Up @@ -1749,16 +1749,13 @@ class LdmsdCmdParser(cmd.Cmd):
if not arg:
return
rc, msg = self.comm.set_route(arg['instance'])
attr_list = msg
if attr_list is None:
print("No response back")

if attr_list[0].attr_id != LDMSD_Req_Attr.JSON:
# Assume that this is an error message
if rc:
print(f"Error {rc}: {msg}")
return

try:
src = json.loads(attr_list[0].attr_value)
src = json.loads(msg)
route = src['route']
print("---------------------")
print("instance: '{0}'".format(src['instance']))
Expand All @@ -1774,14 +1771,14 @@ class LdmsdCmdParser(cmd.Cmd):
print("{0:20} {1:15} {2:15} {3:15} {4:10} {5:10} {6:5} {7:25} {8:25}".format(
hop['host'], hop['type'], detail['name'], detail['host'], detail['update_int'],
detail['update_off'], detail['update_sync'],
self.__ts2human(detail['last_start_sec'], detail['last_start_usec']),
self.__ts2human(detail['last_end_sec'], detail['last_end_usec'])))
self.__ts2human(detail['last_start_sec'], detail['last_start_nsec']),
self.__ts2human(detail['last_end_sec'], detail['last_end_nsec'])))
else:
print("{0:20} {1:15} {2:15} {3:15} {4:10} {5:10} {6:5} {7:25} {8:25}".format(
hop['host'], hop['type'], detail['name'], "---", detail['interval_us'],
detail['offset_us'], detail['sync'],
self.__ts2human(detail['trans_start_sec'], detail['trans_start_usec']),
self.__ts2human(detail['trans_end_sec'], detail['trans_end_usec'])))
self.__ts2human(detail['trans_start_sec'], detail['trans_start_nsec']),
self.__ts2human(detail['trans_end_sec'], detail['trans_end_nsec'])))
except:
raise

Expand Down

0 comments on commit e266f7e

Please sign in to comment.