Skip to content

Commit

Permalink
Fix missing header return in _populate_available_source_ids. (#335)
Browse files Browse the repository at this point in the history
Fix crash when `self.return_header` is False.

```
Traceback (most recent call last):
  File "/home/jdiamond/src/nautilus/./point_one/platform/quectel-lg69t-evb/p1_runner/bin/extract_storage.py", line 215, in <module>
    main()
  File "/home/jdiamond/src/nautilus/./point_one/platform/quectel-lg69t-evb/p1_runner/bin/extract_storage.py", line 127, in main
    reader = MixedLogReader(input_path, message_types=(VersionInfoMessage,), return_header=False, return_bytes=True)
  File "/home/jdiamond/src/nautilus/venv_host_tools/lib/python3.10/site-packages/fusion_engine_client/parsers/mixed_log_reader.py", line 125, in __init__
    self._populate_available_source_ids()
  File "/home/jdiamond/src/nautilus/venv_host_tools/lib/python3.10/site-packages/fusion_engine_client/parsers/mixed_log_reader.py", line 643, in _populate_available_source_ids
    self.available_source_ids.add(header.source_identifier)
AttributeError: 'PlatformStorageDataMessage' object has no attribute 'source_identifier'
```
  • Loading branch information
axlan authored Aug 27, 2024
2 parents 00165d4 + e219e97 commit 6155f83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/fusion_engine_client/parsers/mixed_log_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,10 @@ def get_available_source_ids(self) -> Set[int]:

def _populate_available_source_ids(self, num_messages_to_read: int = 10):
self.available_source_ids = set()
# This function requires that the header is returned. Store the current
# `self.return_header` value.
stored_return_header = self.return_header
self.return_header = True
# Loop over all message types and read N of each type.
for message_type in np.unique(self.index['type']):
message_type = MessageType(message_type, raise_on_unrecognized=False)
Expand All @@ -644,6 +648,7 @@ def _populate_available_source_ids(self, num_messages_to_read: int = 10):

self.clear_filters()

self.return_header = stored_return_header
self.rewind()

def __iter__(self):
Expand Down

0 comments on commit 6155f83

Please sign in to comment.