question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new child to existing column

See original GitHub issue

When adding a child plot to an existing column and then updating the plot appears but then I get the following error:

bokeh.server.protocol.server_handler - ERROR - error handling message Message 'PATCH-DOC' (revision 1): RuntimeError('Cannot apply patch to 8cf5ddd0-9b96-49fc-8099-c792733d0ff5 which is not in the document',)

And my figures come out wonky:

image

 
    def __init__(...):
        ...
        self.sizing_mode = 'scale_width'
        self.figures = {}
        self.sources = {}
        self.root = column(sizing_mode=self.sizing_mode)

    def add_figure(self, name):
        source = ColumnDataSource({'x': [], 'y': []})
        fig = figure(title=name, tools='', height=150, sizing_mode=self.sizing_mode)
        fig.line(source=source, x='x', y='y')
        self.sources[name] = source
        self.figures[name] = fig
        self.root.children = self.root.children + [fig]

    def update(self):
        for name, counter in self.server.counters.items():
            if name not in self.figures:
                self.add_figure(name)
            else:
                xs = [counter.quantile(i / 100) for i in range(101)]
                ys = [xs[i + 1] - xs[i] for i in range(len(xs) - 1)]
                self.sources[name].data.update({'x': xs, 'y': ys})

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Jan 6, 2017

Thanks for the test case, just FYI resolving this is one of my top two priorities for 0.12.5

0reactions
RobMullacommented, Jan 18, 2018

I’m also experiencing this issue.

My version of python and bokeh:

>>> import sys
>>> import bokeh
>>> print(sys.version)
3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
>>> print(bokeh.__version__)
0.12.13

This is a simplified version of the main.py that creates the error.

from bokeh.io import curdoc
from bokeh.layouts import row, column, widgetbox
from bokeh.models.widgets import Slider, TextInput, Button
from bokeh.plotting import figure
from bokeh.models.widgets import Panel, Tabs


def query_prop_data():
    # Query data goes in here
    tab1_plots.children[0] = figure(plot_height=500,
                                    plot_width=1000,
                                    title='QUERY PLOT DONE')
    tab2_plots.children[0] = figure(plot_height=500,
                                    plot_width=1000,
                                    title='QUERY PLOT DONE')
    return


def refresh_plots():
    # Refresh Plot goes in here
    tab1_plots.children[0] = figure(plot_height=500,
                                    plot_width=1000,
                                    title='PLOT REFRESHED')
    return


def update(attr, old, new):
    refresh_plots()
    return


# Setup Widgets
window = Slider(title="Change only tab 1", value=0, start=0, end=35, step=7)
prop_txt = TextInput(placeholder='enter prop code', title='PROPERTY CODE:')
run_button = Button(label='Query', button_type='success')

for widget in [window]:
    widget.on_change('value', update)

for widget in [run_button]:
    widget.on_click(query_prop_data)

inputs = widgetbox(prop_txt, run_button, window)

tab1_plots = row(column())
tab2_plots = row(column())

tab1_plots.children[0] = figure(plot_height=500,
                                plot_width=1000,
                                title='QUERY A PROPERTY TO GENERATE PLOT')
tab2_plots.children[0] = figure(plot_height=500,
                                plot_width=1000,
                                title='QUERY A PROPERTY TO GENERATE PLOT')


tab1 = Panel(child=tab1_plots, title="Tab1")
tab2 = Panel(child=tab2_plots, title="Tab2")

tabs = Tabs(tabs=[tab1, tab2], width=1000)
page_layout = row(children=[inputs, tabs], sizing_mode='fixed')

curdoc().add_root(page_layout)
curdoc().title = "Forecast Analysis"

Only occurs when query_prop_data is called (by clicking the Button)

I start up my server with $bokeh serve --show bokehtest

Each time the query button is clicked I get four lines like this:

2018-01-18 13:48:51,357 Cannot apply patch to aa41f426-0641-4ddf-b418-f0c92bcd3d24 which is not in the document anymore
2018-01-18 13:48:51,359 Cannot apply patch to aa41f426-0641-4ddf-b418-f0c92bcd3d24 which is not in the document anymore
2018-01-18 13:48:51,360 Cannot apply patch to aa41f426-0641-4ddf-b418-f0c92bcd3d24 which is not in the document anymore
2018-01-18 13:48:51,361 Cannot apply patch to aa41f426-0641-4ddf-b418-f0c92bcd3d24 which is not in the document anymore

Not sure if this is a code issue on my part or a bug. Hope that helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding an identity to an existing column - Stack Overflow
Create a new column with identity & drop the existing column. Approach 1. (New table) Here you can retain the existing data values...
Read more >
Creating a Relationship - how to migrate a PK Column as an ...
If you need to merge it with an existing Column in the Child Table, you can Right Mouse Click on the Relationship and,...
Read more >
How to Add A New Column to a Table in SQL?
In Object-Explorer, right-click on the table to which you want to add new columns in a specific order. Click the first blank cell...
Read more >
SQL PRIMARY KEY: How to Create & Add to Existing Table
This tutorial covers SQL Primary Key definitions, rules, How to add a primary key to an existing table in SQL, interesting facts, and...
Read more >
How do I add an FK to an existing column - SqlDBM Support
To connect two table, tool creates new FK column in child table, this is done deliberately to avoid any mistakes by the user....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found