BOKEH服务器中的错误:当我们拥有文档锁时,_pending_writes应该为非无,并且当文档更改时,我们应该具有锁

时间:2019-02-27 10:16:30

标签: bokeh

在示例中,我运行Bokeh服务器以绘制量规图。 它显示得很好,但是当我刷新一两次页面时,服务器会出错:

RuntimeError:当我们拥有文档锁时,_pending_writes应该为“无”,而当文档更改时,我们应该具有锁

fb_report = Panel(child=add_gauge(0.75, 100, 0.05, +1, "red", 25, 5), title = 'Feedback')
  File "/home/osboxes/feedback/reports/charts/basics/gauges.py", line 88, in add_gauge
    plot.add_glyph(glyph)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/models/plots.py", line 306, in add_glyph
    self.renderers.append(g)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/core/property/wrappers.py", line 125, in wrapper
    self._notify_owners(old)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/core/property/wrappers.py", line 152, in _notify_owners
    descriptor._notify_mutated(owner, old, hint=hint)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/core/property/descriptors.py", line 875, in _notify_mutated
    self._real_set(obj, old, value, hint=hint)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/core/property/descriptors.py", line 838, in _real_set
    self._trigger(obj, old, value, hint=hint, setter=setter)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/core/property/descriptors.py", line 915, in _trigger
    obj.trigger(self.name, old, value, hint, setter)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/model.py", line 599, in trigger
    super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/util/callback_manager.py", line 143, in trigger
    self._document._notify_change(self, attr, old, new, hint, setter, invoke)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/document.py", line 1004, in _notify_change
    self._trigger_on_change(event)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/document.py", line 1099, in _trigger_on_change
    self._with_self_as_curdoc(invoke_callbacks)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/document.py", line 1112, in _with_self_as_curdoc
    return f()
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/document.py", line 1098, in invoke_callbacks
    cb(event)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/document.py", line 668, in <lambda>
    self._callbacks[receiver] = lambda event: event.dispatch(receiver)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/events.py", line 244, in dispatch
    super(ModelChangedEvent, self).dispatch(receiver)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/document/events.py", line 126, in dispatch
    receiver._document_patched(self)
  File "/home/osboxes/.local/lib/python3.5/site-packages/bokeh/server/session.py", line 214, in _document_patched
    raise RuntimeError("_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes")
RuntimeError: _pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes

这是我的代码:

#Bokeh application file: test.py

from bokeh.io import curdoc
from bokeh.layouts import row, column

from charts.processor import Processor
from init import const, Log

processor = Processor()
reports = processor.makeReport()

curdoc().add_root(reports)


#File charts/processor.py:

class Processor():
    form = None
    callback = None

    def __init__(self, data=None):
        return


    def makeReport(self):
        gchat = Gauge()
        fb_report = Panel(child=gchat.add_gauge(0.75, 100, 0.05, +1, "red", 25, 5), title = 'Feedback')

        tabs = Tabs(tabs = [ fb_report ])


        return tabs



#File charts/basics/gauges.py

class Gauge():


def add_gauge(self, radius, max_value, length, direction, color, major_step, minor_step):
    plot = Plot(x_range=xdr, y_range=ydr, plot_width=600, plot_height=600)
    plot.toolbar_location = None
    plot.outline_line_color = None

    start_angle = pi + pi/4
    end_angle = -pi/4

....
    text_angles = [ angle - pi/2 for angle in major_angles ]
    source = ColumnDataSource(dict(x=x, y=y, angle=text_angles, text=major_labels))

    glyph = Text(x="x", y="y", angle="angle", text="text", text_align="center", text_baseline="middle")
    plot.add_glyph(source, glyph)

    return plot

有人可以帮助我吗?谢谢

0 个答案:

没有答案