Closed KPrasch closed 4 years ago
The full exception is
Unable to format event {'system': 'wsgi', 'isError': True, 'message': ('[2020-03-06 16:17:04,568] ERROR in app: Exception on /_dash-update-component [POST]\nTraceback (most recent call last):\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app\n response = self.full_dispatch_request()\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request\n rv = self.handle_user_exception(e)\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception\n reraise(exc_type, exc_value, tb)\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise\n raise value\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request\n rv = self.dispatch_request()\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/dash/dash.py", line 1461, in dispatch\n response.set_data(self.callback_map[output]["callback"](*args))\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/dash/dash.py", line 1341, in add_context\n output_value = func(*args, **kwargs) # %% callback invoked %%\n File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/dashboard.py", line 125, in known_nodes\n node_tables = components.known_nodes(nodes_dict=data[\'node_details\'])\n File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/components.py", line 219, in known_nodes\n buckets = {\'active\': sorted([*nodes_dict[\'confirmed\'], *nodes_dict[\'pending\']], key=lambda n: n[\'timestamp\']),\nKeyError: \'confirmed\'\n',), 'log_logger': <Logger 'twisted.web.wsgi._ErrorStream'>, 'log_level': <LogLevel=error>, 'log_namespace': 'twisted.web.wsgi._ErrorStream', 'log_source': <twisted.web.wsgi._ErrorStream object at 0x10647b050>, 'log_format': '[2020-03-06 16:17:04,568] ERROR in app: Exception on /_dash-update-component [POST]\nTraceback (most recent call last):\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app\n response = self.full_dispatch_request()\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request\n rv = self.handle_user_exception(e)\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception\n reraise(exc_type, exc_value, tb)\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise\n raise value\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request\n rv = self.dispatch_request()\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/dash/dash.py", line 1461, in dispatch\n response.set_data(self.callback_map[output]["callback"](*args))\n File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/dash/dash.py", line 1341, in add_context\n output_value = func(*args, **kwargs) # %% callback invoked %%\n File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/dashboard.py", line 125, in known_nodes\n node_tables = components.known_nodes(nodes_dict=data[\'node_details\'])\n File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/components.py", line 219, in known_nodes\n buckets = {\'active\': sorted([*nodes_dict[\'confirmed\'], *nodes_dict[\'pending\']], key=lambda n: n[\'timestamp\']),\nKeyError: \'confirmed\'\n', 'log_time': 1583529424.568458}: unmatched '{' in format spec
Temporarily disabling observer <twisted.logger._file.FileLogObserver object at 0x107b05fd0> due to exception: [Failure instance: Traceback: <class 'ValueError'>: unmatched '{' in format spec
/Users/derek/anaconda3/lib/python3.7/logging/__init__.py:1028:emit
Which seems to boil down to the following:
"/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/components.py", line 219, in known_nodes\n buckets = {\'active\': sorted([*nodes_dict[\'confirmed\'], *nodes_dict[\'pending\']], key=lambda n: n[\'timestamp\']),\nKeyError: \'confirmed\'\n',
The cause of this issue is if the dashboard is run too early, then the crawler doesn't know about many nodes and sometimes just the teacher. Example stats output
...
'next_period': '1 day, 0:00:00',
'node_details': {'unconfirmed': [{'fleet_state_icon': '?',
'last_seen': 'No Connection to Node',
'nickname': 'DarkMagenta Diamond Red Mountain',
'rest_url': '54.152.254.4:9151',
'staker_address': '0xcC0678E51a8237b762c09d6548d2d07285609e98',
'status': {'color': 'red',
'missed_confirmations': 27,
'status': 'Unconfirmed'},
'timestamp': '2020-01-21T00:45:40Z',
'uptime': '48d:18h:27m'}]},
'prev_states': [{'color_hex': '#4169E1',
'color_name': 'RoyalBlue',
'nickname': 'RoyalBlue Saturn',
'symbol': '♄',
'updated': 'Mon, 09 Mar 2020 19:12:55 GMT'}],
...
The node_details only has one node in it that is unconfirmed
. The resulting node_details
dict therefore has no entry for confirmed
leading to a KeyError
.
This is fixed via https://github.com/nucypher/nucypher-monitor/pull/53/commits/e747fcf64ed2916447462f00ea7a8ad27d002fb8 in #53.
Fixed in #53 (merged via #26)