usnistgov / nestor-tmp2

Quantifying tacit knowledge for investigatory analysis
Other
9 stars 5 forks source link

bokeh server #42

Open timothysprock opened 5 years ago

timothysprock commented 5 years ago

When clicking on the Node-Link diagram link for the first time, the website/server serves an error (on the website). The terminal states that "INFO: bokeh.client.connection:Failed to connect to server: ConnectionRefusedError (10061, 'Unknown Error')", and THEN it starts the bokeh server. If I reload the node-link diagram, it works. tldr; the website tries to query bokeh before it starts bokeh.

MichaelPBrundage commented 5 years ago

builtins.OSError OSError: Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)

Traceback (most recent call last) File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1997, in call return self.wsgi_app(environ, start_response) File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask_compat.py", line 33, in reraise raise value File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask_compat.py", line 33, in reraise raise value File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\nestor\dash\views.py", line 143, in node with pull_session(url="http://localhost:5006/node_mach") as session: File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\bokeh\client\session.py", line 113, in pull_session session.pull() File "c:\users\mpb1\appdata\local\continuum\anaconda3\lib\site-packages\bokeh\client\session.py", line 343, in pull raise IOError("Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)") OSError: Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command) The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame dump(obj) dumps all that's known about the object

rtbs-dev commented 5 years ago

Bokeh needs time to start. Generally I go to the dashboard page first (though it has no actual functionality as of now) and then go to the plots...

Unsure how to fix this soon, except give the user a heads up. Glad it loads correctly the second load though.

Perhaps a callback function to enable the routing function upon seeing an open bokeh server?

timothysprock commented 5 years ago

Is there any reason why you can't just start the bokeh server when you load the homepage? You're going to use it for everything (except file upload), so its instance won't be wasted nor be needless overhead

lelatbones commented 5 years ago

So a fix to this is we don’t allow any of the diagram pages to load until the server is found, and we could do a try/catch for that. And we would ideally have it pre-loaded, but we can’t start the bokeh server until the user uploads the file. That’s actually when it’s being called, and that’s why there’s a little delay if you go directly to another page. Or like if you want to get fancy we could have a little loading icon if the server hasn’t been found yet.

rtbs-dev commented 5 years ago

I'm going to move this out of the milestones for 0.3, we need to address the dashboard more holistically for 0.4 or some other future release.