multithread session error

Hi guys,

I use multithread to update columndatasource and figure. after inplementation, I get this runtimewrror, and also I added lock in my code. the problem is still there. thanks for any feedback.

“thread pending writes should be non-None when have a document lick, and we should have the lock when the document changes”

Hi,

Updates from threads must go through a "next_tick_callback" to ensure proper locking, as described in the documentation:

  https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#updating-from-threads

Thanks,

Bryan

···

On Jul 23, 2018, at 08:37, peng wang <[email protected]> wrote:

Hi guys,

I use multithread to update columndatasource and figure. after inplementation, I get this runtimewrror, and also I added lock in my code. the problem is still there. thanks for any feedback.

"thread pending writes should be non-None when have a document lick, and we should have the lock when the document changes"

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e2be2818-b960-4a5b-a8d4-4ff4ec073fb7%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thank you Buddy, the issue is gone. I like to post my solution below, just for reference

@gen.coroutine

def update_main_plot_source(main_plot, main_plot_dict, depth_list, mainplot_data_all, mainplot_source):
#todo

def update_main_plot_chart( doc, \

update_main_plot_event, \

mainplot_source, \

main_plot, \

mainplot_data_all, \

checkbox_group_1_selections, \

checkbox_group_2_selections,\

checkbox_group_3_selections, \

all_connection_dict,\

rig, \

job, \

from_comboBx_group):

update_main_plot_event.wait()

main_plot_dict = {}

depth_list =

if from_comboBx_group == True:

main_plot_dict = update_checkBx_groups_dict(all_connection_dict, \

rig, job, \

checkbox_group_1_selections, \

checkbox_group_2_selections)

main_plot_dict, depth_list = update_main_plot_dict(main_plot_dict, checkbox_group_3_selections)

else:

main_plot_dict = update_checkBx_groups_dict(all_connection_dict, \

rig, job)

main_plot_dict, depth_list = update_main_plot_dict(main_plot_dict)

depth_list = [str(x) for x in depth_list]

doc.add_next_tick_callback(partial(update_main_plot_source, main_plot = main_plot, main_plot_dict = main_plot_dict, depth_list = depth_list, mainplot_data_all = mainplot_data_all, mainplot_source = mainplot_source))

update_main_plot_queue = queue.Queue()

update_main_plot_event = threading.Event()

update_main_plot_thread = Thread(name='update_main_plot_thread', \

                                 target =  lambda q, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12: q.put(all_main_plot.update_main_plot_chart(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)), \

                                 args = (update_main_plot_queue, \

                                         doc, \

                                         update_main_plot_event, \

                                         mainplot_source, \

                                         main_plot, \

                                         mainplot_data_all, \

                                         checkbox_group_1_selections, \

                                         checkbox_group_2_selections,\

                                         checkbox_group_3_selections, \

                                         all_connection_dict,\

                                         rig, \

                                         job, \

                                         from_comboBx_group))

update_main_plot_thread.start()

update_main_plot_event.set()

``

···

On Monday, July 23, 2018 at 9:40:25 AM UTC-6, Bryan Van de ven wrote:

Hi,

Updates from threads must go through a “next_tick_callback” to ensure proper locking, as described in the documentation:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#updating-from-threads](https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#updating-from-threads)

Thanks,

Bryan

On Jul 23, 2018, at 08:37, peng wang [email protected] wrote:

Hi guys,

I use multithread to update columndatasource and figure. after inplementation, I get this runtimewrror, and also I added lock in my code. the problem is still there. thanks for any feedback.

“thread pending writes should be non-None when have a document lick, and we should have the lock when the document changes”


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e2be2818-b960-4a5b-a8d4-4ff4ec073fb7%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.