Save status variables during runtime#107
Conversation
…di-core into save_status_variables
# Conflicts: # src/qudi/core/modulemanager.py
| with self._lock: | ||
| for _, module in self.modules.items(): | ||
| if module.is_active: | ||
| module.instance._dump_status_variables() |
There was a problem hiding this comment.
Evil access on private method. On the first glance, we might elevate dump_status_variables() to a public function.
There was a problem hiding this comment.
The method has been elevated to a public function.
| self.automated_status_variable_dumping_timer.stop() | ||
| try: | ||
| self.automated_status_variable_dumping_timer.timeout.disconnect() | ||
| except RuntimeError: |
There was a problem hiding this comment.
What's the origin of the RuntimeError?
There was a problem hiding this comment.
If the timer was already destroyed (or never activated), calling the disconnect function will result in a RuntimError. To not have this throw an Error during e.g. shutdown of Qudi, just do nothing.
| """ | ||
| self._automated_status_variable_dumping_timer_interval = interval | ||
|
|
||
| def automated_status_variable_dumping_timer_interval_slot(self, interval): |
There was a problem hiding this comment.
Why do we need a setter and a slot?
There was a problem hiding this comment.
The slot is called by the signal from the GUI, as signals can't call setter methods. The setter method is there for a consistent cli property behaviour.
There was a problem hiding this comment.
I have changed the slot method to only pass the variable on to the setter. The setter now handles the actual setting of the timer.
| self.automated_status_variable_dumping_timer.start() | ||
|
|
||
| @property | ||
| def automated_status_variable_dumping_timer_interval(self): |
There was a problem hiding this comment.
Units of all qudi variables should be SI (preferred) or part of the variable name.
There was a problem hiding this comment.
Now the modulemanager only handles the interval in seconds.
| return self._automated_status_variable_dumping_timer_interval | ||
|
|
||
| @automated_status_variable_dumping_timer_interval.setter | ||
| def automated_status_variable_dumping_timer_interval(self, interval): |
There was a problem hiding this comment.
There should be some value checking. From non-gui, interval=0 will probably cause issues.
There was a problem hiding this comment.
I introduced an Exception that is thrown if the interval is <= 0.
|
I addressed the comments and merged main into this branch . Please check if other changes should be made. |
|
On a sidenote I discovered that when using |
fixed disconnection error
|
Hi @TobiasSpohn , |
Description
This pull request adds a button in the main GUI to manually save the status variables during runtime of qudi. Furthermore, an option to enable automatic saving is implemented, which will periodically save the status variables with an interval, set by the user. By default the automatic dumping is turned off.
Motivation and Context
Qudi saves status variables of modules during deactivation of said module. When qudi crashes or a module is not correctly deactivated it may lead to status variables not being saved. To tackle this inconvenience a manual and automatic method of saving status variables during runtime is implemented.
How Has This Been Tested?
Tested on confocal setup using the
iqo-modulesscanning toolchain and performing a 2000 px x 2000 px scan and performing pulsed measurements using the pulsed toolchain.Types of changes
Checklist:
/docs/changelog.md.(syntax, indentation, mutable default values, etc.).