-
Notifications
You must be signed in to change notification settings - Fork 141
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
FIX Improve robustness of attribute query for JSProxy
#456
Conversation
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 don't quite understand why accessing self.attrs
starts a query.
But the PR looks good to me.
(Failing tests are unrelated. They are due to a deprecated function in nibabel 4.0.)
From my reading of the code, pycortex/cortex/webgl/serve.py Lines 324 to 334 in 908cc80
|
Oh right, I missed that for some reason, thanks! |
…bglview * 'fix/webglview' of github.com:mvdoc/pycortex: Increase wait time MNT remove unused code FIX avoid querying too many times Missed one line ENH try to add waiting time directly to JSProxy FIX reuse the surface obj FIX deal with keyerror in how __getattr__ is defined FIX generalize how to get an attr from self.ui Better print message Attempt to fix JS UI errors FIX update nibabel deprecated methods (gallantlab#457)
Unfortunately, the viewer still crashes from time to time. It seems to me that 10s should be enough time to wait, so maybe the problem is somewhere else. :\ |
Does it crash after the 10sec wait? |
Yep, it crashes with the same error: ( |
This new change I implemented seems to have solved the problem (🤞). I made a new property for |
attr
from JSProxy objects for a max of 10s before failing JSProxy
Functions like
code.export.plot_panels
fail from time to time in an unpredictable way. It looks like the culprit is that theJSProxy
object tries to get some attributes that do not exist yet (see #449). However, when inspecting the JavaScript console, those attributes do exist. This suggests that the querying process is not robust enough to random delays in updating the viewer/JS environment.This PR adds a simple logic that queries for the desired attr up to 10s before giving up. It should make the querying process a bit more robust.
Closes #449 (hopefully for good)