-
Notifications
You must be signed in to change notification settings - Fork 56
Add plugin lock monitor #88
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
base: master
Are you sure you want to change the base?
Conversation
A few questions and points maybe worth mentioning...
For reference, the error raised when using Jupyter ErrorUnsupportedOperation Traceback (most recent call last)
<ipython-input-30-b2967eed1dc1> in <module>
1 from labscript_utils.setup_logging import setup_logging
2
----> 3 setup_logging('jupyter_test')
c:\users\username\software\labscript\labscript-utils\labscript_utils\setup_logging.py in setup_logging(program_name, log_level, terminal_level, maxBytes, backupCount)
53 handler.setLevel(log_level)
54 logger.addHandler(handler)
---> 55 if sys.stdout is not None and sys.stdout.fileno() >= 0:
56 stdout_handler = logging.StreamHandler(sys.stdout)
57 stdout_handler.setFormatter(formatter)
UnsupportedOperation: fileno |
I'm having an issue with this code. It seems to work for the DummyLocker except for when I shut down blacs. I then get the error: It seems like in the tab_base_classes.py file the PluginTab class (which LockMonitorTab inherits from) has no shutdown_workers method. Should PluginTab inherit from the Tab class, or is there something else that I'm missing? |
I did run into an issue like that (#86) when developing this plugin, and made a separate PR (#87) to fix it. I don't think that the branch for this PR includes the fix from that other PR though, which may be why you're seeing this issue. Could you try rebasing this branch on master in your local copy of the blacs repo? If that does work, then I can update this PR. That said, the traceback you provided looks slightly different than I would expect if the issue were just that the |
That fixed it, thanks! |
…ed before. Previously its Setting class could handle when self.data['import_paths'] wasn't set, but the Plugin class would get tripped up. To work around this, the default value for that key is set in Setting.__init__() now.
The issue was that the same name was given for the logger for both the DummyLocker and DummyScanZoomLocker, which meant that they actually shared one logger. This led to dupplicated outputs, probably due to multiple handlers being added to the same logger.
The new screenshot no longer shows the duplicated logging entries issue resolved by the previous commit.
Perfect! Thanks for checking, I just updated this PR by rebasing its branch on master |
This PR would add a plugin called "lock monitor" to blacs. Since plugins are able to be distributed separately from blacs, adding this to the official blacs repo definitely isn't necessary. However since laser locks are ubiquitous among labscript users I thought I'd see what you all thought about including it with blacs? Including it might be particularly helpful for folks who don't have a developer install of blacs, as I'm not sure if they can easily add plugins.
A lot of details about the plugin are provided in the readme. Briefly the plugin is designed to call user-written code to check if lasers are in lock and optionally call user-written code to lock a laser when it is found to be out of lock. The user-written code is called during some of the plugin callbacks in
blacs.experiment_queue.QueueManager.manage()
. The plugin itself sandboxes user code in worker processes and handles aborting and re-queueing shots when lasers go out of lock. It also pauses the shot queue when a laser cannot be locked. Controls for lockers are provided in a blacs plugin tab which also includes an output box for displaying log messages from the lockers. A settings tab is provided for adding/removing lockers.A readme is provided, as well as base classes for the locker classes that the user must write. Dummy locker classes are also provided. They don't control any real hardware but they do demonstrate how to write locker classes and can be used with lock monitor like real lockers.
Note that running this plugin requires #87 due to #86. Also, thanks to @philipstarkey for pointing me to some good references for writing blacs plugins!