-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save status variables during runtime #107
base: main
Are you sure you want to change the base?
Conversation
…di-core into save_status_variables
# Conflicts: # src/qudi/core/modulemanager.py
src/qudi/core/modulemanager.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method has been elevated to a public function.
src/qudi/core/modulemanager.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the origin of the RuntimeError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/qudi/core/modulemanager.py
Outdated
""" | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a setter and a slot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/qudi/core/modulemanager.py
Outdated
self.automated_status_variable_dumping_timer.start() | ||
|
||
@property | ||
def automated_status_variable_dumping_timer_interval(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Units of all qudi variables should be SI (preferred) or part of the variable name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the modulemanager only handles the interval in seconds.
src/qudi/core/modulemanager.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be some value checking. From non-gui, interval=0 will probably cause issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-modules
scanning 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.).