{"action":"created","issue":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/4053","repository_url":"https://api.github.com/repos/bokeh/bokeh","labels_url":"https://api.github.com/repos/bokeh/bokeh/issues/4053/labels{/name}","comments_url":"https://api.github.com/repos/bokeh/bokeh/issues/4053/comments","events_url":"https://api.github.com/repos/bokeh/bokeh/issues/4053/events","html_url":"https://github.com/bokeh/bokeh/issues/4053","id":142739052,"number":4053,"title":"Button Read is Slow In Bokeh Server","user":{"login":"redraven984","id":13949732,"avatar_url":"https://avatars.githubusercontent.com/u/13949732?v=3","gravatar_id":"","url":"https://api.github.com/users/redraven984","html_url":"https://github.com/redraven984","followers_url":"https://api.github.com/users/redraven984/followers","following_url":"https://api.github.com/users/redraven984/following{/other_user}","gists_url":"https://api.github.com/users/redraven984/gists{/gist_id}","starred_url":"https://api.github.com/users/redraven984/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redraven984/subscriptions","organizations_url":"https://api.github.com/users/redraven984/orgs","repos_url":"https://api.github.com/users/redraven984/repos","events_url":"https://api.github.com/users/redraven984/events{/privacy}","received_events_url":"https://api.github.com/users/redraven984/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bokeh/bokeh/labels/type:%20discussion","name":"type: discussion","color":"2659A0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":38,"created_at":"2016-03-22T18:31:14Z","updated_at":"2016-03-23T14:17:37Z","closed_at":null,"body":"Hi All,\r\n\r\nI recently discussed this issue in the Bokeh User Group. It appears that the button implementation in Bokeh is not capable of capturing button clicks when the update speed in the Bokeh Server is too fast. To give a concrete example, here is some sample code:\r\n\r\n====================== Sample Code ==========================================\r\n```\r\ndef update():\r\n             print \" Button Group State: \" +str(button_group.active)\r\n\r\nbutton_group = RadioButtonGroup( labels=[\"State 1\", \"State 2\"], active=0)\r\n\r\n# open a session to keep our local document in sync with server\r\nsession = push_session(curdoc())\r\ncurdoc().add_root(button_group)\r\ncurdoc().add_periodic_callback(update, 50)\r\n\r\nsession.show() # open the document in a browser\r\nsession.loop_until_closed() # run forever\r\n```\r\n==============================================================================\r\n\r\nIt appears that the active state switch will register if the callback update time is > 250ms (im sure this is computer dependent).\r\n\r\nThings I have tried to remedy the problem:\r\n1. Run slower - this working but is just not feasible in my application. I need to be running at 50ms or faster to keep ahead of a real time process.\r\n2. Multithreading - Assign a new thread to the callback function. This does not seem to have any effect. \r\n3. Writing a handler function to be called \"on_click\". This function suffers from the same problem as just querying the active state.\r\n\r\nAlso the discussion topics that I started in the user group are here:\r\nhttps://groups.google.com/a/continuum.io/forum/#!topic/bokeh/i23r_HhdWJU\r\n\r\nand\r\n\r\nhttps://groups.google.com/a/continuum.io/forum/#!topic/bokeh/4ot4FHeOUPI\r\n\r\nThanks for your help. I am willing to experiment and help in developing a new fix for this issue."},"comment":{"url":"https://api.github.com/repos/bokeh/bokeh/issues/comments/200363527","html_url":"https://github.com/bokeh/bokeh/issues/4053#issuecomment-200363527","issue_url":"https://api.github.com/repos/bokeh/bokeh/issues/4053","id":200363527,"user":{"login":"bryevdv","id":1078448,"avatar_url":"https://avatars.githubusercontent.com/u/1078448?v=3","gravatar_id":"","url":"https://api.github.com/users/bryevdv","html_url":"https://github.com/bryevdv","followers_url":"https://api.github.com/users/bryevdv/followers","following_url":"https://api.github.com/users/bryevdv/following{/other_user}","gists_url":"https://api.github.com/users/bryevdv/gists{/gist_id}","starred_url":"https://api.github.com/users/bryevdv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryevdv/subscriptions","organizations_url":"https://api.github.com/users/bryevdv/orgs","repos_url":"https://api.github.com/users/bryevdv/repos","events_url":"https://api.github.com/users/bryevdv/events{/privacy}","received_events_url":"https://api.github.com/users/bryevdv/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T14:17:37Z","updated_at":"2016-03-23T14:17:37Z","body":"After running with the env var set, the output is in the browser Javascript console, not the server output. That turns on logging in the client (the browser). \r\n\r\n> Also, removing the session commands from my file leads to no dashboard on screen. In essence if I dont use the API there is no canvases created on screen and no update loop. \r\n\r\nServer apps definitely don't need them (none of the hosted example on the demo site use them, for instance). The `session` stuff is only needed when updating to the server from a *separate* python process (connecting to the server from python is in fact the only purpose of session objects). Unfortunately I can't really say offer more concrete. "}}