fix: bokeh logging noise - #140
Open
rileythai wants to merge 4 commits into
Open
Conversation
- prevent callback from occuring upstream in patched jupyter_bokeh version (which should be moved to a submodule but relied on compiled artifacts to attach the env) - also explicitly remove the Widget from the document with a cleanup callback - this doesn't fix "No such comm" issues (they still spawn N no comm messages on add/remove, where N is the number of effects attached I think) - added currently as a uv tool source but we can change later
- the messages are completely harmless and only occur on add remove - the reason comm messages like this occur is because a JS message is probably trying to hit a non-existent (or mis-identified widget) - another way would be to rewrite the grid but it needs reserialized objects to actually update and rerender properly - the easiest way is to make it quiet via making the logger quiet
- we patch directly in the BokehModel, i don't know if it's too overscoped to add this to BokehModel because I dont know if anyone else uses the class like this - confirmed working in docker compose - removed from pyproject/uv.lock/docker
- they have underscores sometimes
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.
this PR fixes #129 by doing two things:
BokehModelfromjupyter_bokehwhich prevents theKeyErrormessages and drops events and callbacks prior to things.The mechanisms are basically:
No such commcomes from thecommmodule's logger, presumably because there are JS messages that hang from callbacks after the object is changed on add/remove. The fix is to just make the logger quiet.KeyErroris because of garbage collection. It happens randomly (whenever garbage collection decides to run), but is mostly harmless. Because the entire object is serialized and then later updated, we need to ensure the object is deleted and only tried to be deleted if it's actually there (I don't know which case it is but it should already be deleted when thegccalls it).There are now explicit cleanup callbacks in
FigureBokehand a new patched subclassBokehModel(SafeBokehModel) which overrides thecloseand_sync_modelmethods to handle these error cases.The
DeserializationErroronly sometimes occured in mydockertests.The PR also bumps
jupyter_bokeh>=4.1.0.