Skip to content

Commit

Permalink
logger for bandwidth test
Browse files Browse the repository at this point in the history
note when subject table isn't changed
  • Loading branch information
sneakers-the-rat committed May 11, 2022
1 parent 0ad581b commit 59482cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions autopilot/data/interfaces/tables.py
Expand Up @@ -119,6 +119,8 @@ def make(self, h5f:tables.file.File):
elif set(node.description._v_names) != set(list(self.description.columns.keys())):
self._logger.warning(f"Found existing table with columns {node.description._v_names}, but requested a table with {list(self.description.columns.keys())}, remaking.")
self._remake_table(h5f)
else:
self._logger.warning('Found existing table that matches the requested description, not remaking.')

except tables.exceptions.NoSuchNodeError:
tab = h5f.create_table(self.parent, self.name, self.description,
Expand Down
11 changes: 7 additions & 4 deletions autopilot/gui/menus/tests.py
Expand Up @@ -12,6 +12,7 @@
from autopilot import prefs
from autopilot.gui.gui import gui_event
from autopilot.networking import Net_Node
from autopilot.core.loggers import init_logger


class Bandwidth_Test(QtWidgets.QDialog):
Expand Down Expand Up @@ -59,6 +60,7 @@ def __init__(self, pilots):
port = prefs.get('MSGPORT'),
listens=self.listens)
self.node.send('T', 'INIT')
self.logger = init_logger(self)

self.init_ui()

Expand Down Expand Up @@ -434,8 +436,10 @@ def register_msg(self, value):
receive_time = datetime.datetime.now().isoformat()

try:
assert isinstance(value['payload'], np.ndarray)
assert value['payload'].shape[0] == int(value['payload_n'])
if value['payload_n']>0:
assert isinstance(value['payload'], np.ndarray)
#print(value['payload'].shape, value['payload_n'], type(value['payload']))
assert value['payload'].shape[0] == int(value['payload_n']*128)

self.messages.append((value['pilot'],
int(value['n_msg']),
Expand All @@ -444,8 +448,7 @@ def register_msg(self, value):
payload_size,
value['message_size']))
except AssertionError:
self.logger.exception(f"Payload was not a numpy array or didnt have the expected size")
return
self.logger.exception(f"Payload was not a numpy array or didnt have the expected size\ngot a {type(value['payload'])}")

#payload_size = np.frombuffer(base64.b64decode(value['payload']),dtype=np.bool).nbytes

Expand Down

0 comments on commit 59482cd

Please sign in to comment.