Skip to content

FIX: Fix Main Thread Hanging from caget Call#150

Merged
zdomke merged 8 commits into
ui_redesignfrom
zdomke/dit-hookup
May 6, 2025
Merged

FIX: Fix Main Thread Hanging from caget Call#150
zdomke merged 8 commits into
ui_redesignfrom
zdomke/dit-hookup

Conversation

@zdomke

@zdomke zdomke commented Apr 28, 2025

Copy link
Copy Markdown
Collaborator

Main Problem

The DataInsightTool from #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 the DataInsightTool. 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_data would throw errors if the user tried a caget call on a PV that doesn't exist. This function was trying to concatenate a NoneType with a str. Instead I am using str.join() to construct the meta data label text.
  • The table was displaying the curve's unpopulated buffer if there was no real live data. This has been resolved.
  • If the archiver tool sends an OK response with no data, an error was thrown. Now a warning message is logged stating that no data was received.
  • In config.py I set the environment variable for NUMEXPR_MAX_THREADS if it is not already set because it not being set prints a warning on start up.

@zdomke

This comment was marked as resolved.

@zdomke zdomke requested a review from a team April 28, 2025 23:52
@zdomke zdomke self-assigned this Apr 28, 2025
@zdomke zdomke added the bug Something isn't working label Apr 28, 2025
@zdomke zdomke added this to the Trace 1.5 milestone Apr 28, 2025
@zdomke zdomke linked an issue Apr 28, 2025 that may be closed by this pull request
@zdomke zdomke requested a review from YektaY April 30, 2025 22:54
@zdomke

zdomke commented Apr 30, 2025

Copy link
Copy Markdown
Collaborator Author

I added the "Loading..." text to the label. I'm not entirely sure why the DIT is displaying filler data for the invalid curve though. That table should be empty. Will look into it.

This comment was resolved in commit a4f1743

@YektaY YektaY left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. I have tested some of the changes here and they addressed the issues listed. great work!

@zdomke zdomke merged commit 4a00223 into ui_redesign May 6, 2025
@zdomke zdomke deleted the zdomke/dit-hookup branch June 13, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] - Redesign Trace

2 participants