FIX: Fix Main Thread Hanging from caget Call#150
Merged
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Collaborator
Author
This comment was resolved in commit a4f1743 |
YektaY
approved these changes
May 6, 2025
YektaY
left a comment
Collaborator
There was a problem hiding this comment.
looks good to me. I have tested some of the changes here and they addressed the issues listed. great work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main Problem
The
DataInsightToolfrom #147 was causing the main thread to hang whenever a new curve was added. This came from a caget on a PV that didn't exist, resulting in the thread waiting the whole 5s timeout delay.Main Fix
Move the caget call to a separate worker thread. The thread is spawned from the
DataVisualizationModel. The model saves the description as an attribute and will prompt an update of theDataInsightTool. The meta_data label will be populated with a "Loading..." message while waiting for a CA response. This will really only be visible when the PV doesn't exist and is waiting to timeout.Minor Fixes
DataInsightTool.set_meta_datawould throw errors if the user tried a caget call on a PV that doesn't exist. This function was trying to concatenate aNoneTypewith astr. Instead I am usingstr.join()to construct the meta data label text.OKresponse with no data, an error was thrown. Now a warning message is logged stating that no data was received.config.pyI set the environment variable forNUMEXPR_MAX_THREADSif it is not already set because it not being set prints a warning on start up.