mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-13 00:07:11 +02:00
feat: adding support for saving the status of a DataService class
By passing a the "filename" keyword to the DataService init function, one can save the state of the instance in this file. Quitting the service (Ctrl+C) will dump the state of the instance in the file with given filename. When starting the instance, it will load these values again.
This commit is contained in:
@ -173,6 +173,9 @@ class Server:
|
||||
async def shutdown(self) -> None:
|
||||
logger.info("Shutting down")
|
||||
|
||||
logger.info(f"Saving data to {self._service._filename}.")
|
||||
self._service.write_to_file()
|
||||
|
||||
await self.__cancel_servers()
|
||||
await self.__cancel_tasks()
|
||||
|
||||
|
Reference in New Issue
Block a user