I’m trying to update plots using asyncio. The structure of my callback is:
def periodic_plot_update():
update_plot("", "", "")
set_title("", "", "")
async def apc_cb():
_ = await asyncio.wrap_future(
executor.submit(periodic_plot_update), loop=None
)
doc.add_next_tick_callback(partial(self.dummy_update))
apc_cb.nolock = True
self.apc = doc.add_periodic_callback(
apc_cb,
5000,
)
In the update_plot function, I do data processing and update the column data source by cds.update(data=df). dummy_update is a print function to let me know the update was run. Now I’m having a RuntimeError: RuntimeError: _pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes. The error is at the cds.update step and I’m not sure why. Does anyone have any clue why? I did some small test, running print(“something”) inside the periodic_plot_update function, and it ran, but when involving the cds, it doesn’t.
Thank you,
H

