Skip to content

Commit

Permalink
bugfix: memory management state saving/loading
Browse files Browse the repository at this point in the history
  • Loading branch information
lane-neuro committed Jun 25, 2024
1 parent 2dd70b4 commit 2673e77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion research_analytics_suite/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ def main():

if __name__ == '__main__':
sys.argv = ['__main__.py',
'-n', "RAS-test-workspace",
'-o', "RAS-test-workspace",
]
main()
12 changes: 8 additions & 4 deletions research_analytics_suite/data_engine/Workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,17 @@ async def save_memory_manager(self, file_path):
# Remove any slots that are not serializable
collections_data = remove_non_serializable(collections_data)

# Remove any slots that start with 'gui_' or 'sys_'
collections_data = {
k: v for k, v in collections_data.items() if not k.startswith('gui_') and not k.startswith('sys_')
}

await dst.write(json.dumps(collections_data))

self._logger.info(f"User variables saved to {file_path}")
self._logger.info(f"Memory Management saved to {file_path}")

except Exception as e:
self._logger.error(Exception(f"Failed to save user variables: {e}"), self)
self._logger.error(Exception(f"Failed to save Memory Management: {e}"), self)

async def restore_memory_manager(self, file_path):
"""
Expand All @@ -431,8 +436,7 @@ async def restore_memory_manager(self, file_path):
collections_data = json.loads(await src.read())

for collection_id, collection_dict in collections_data.items():
collection = await MemorySlotCollection.from_dict(collection_dict)
self._memory_manager.add_collection(collection)
await MemorySlotCollection.from_dict(collection_dict)

self._logger.info(f"Memory restored from {file_path}")
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions research_analytics_suite/gui/launcher/GuiLauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def setup_main_window(self) -> None:
dpg.show_viewport()
await self.dpg_async.start()

with dpg.window(label="RAS", tag="main_window",
with dpg.window(label="Research Analytics Suite - Main Window", tag="main_window",
width=dpg.get_viewport_width(), height=dpg.get_viewport_height()):
with dpg.group(horizontal=True, tag="main_pane", height=dpg.get_viewport_height() - 370):
with dpg.child_window(tag="left_pane", width=200):
Expand Down Expand Up @@ -232,7 +232,7 @@ async def setup_planning_pane(self) -> None:
async def setup_data_collection_pane(self) -> None:
"""Sets up the data collection pane asynchronously."""
with dpg.group(parent="data_collection_pane"):
self.data_collection_dialog = DataCollectionDialog(width=800, height=600)
# self.data_collection_dialog = DataCollectionDialog(width=800, height=600)
dpg.add_text("Data Collection Tools")
await self.data_collection_dialog.show_memory_collections()

0 comments on commit 2673e77

Please sign in to comment.