We are running a bokeh server using this command:
nohup {EDGE_HOME}/thirdParty/Anaconda3/bin/bokeh serve pangia-vis --port 5100 --keep-alive 10000 --host '*' &> {EDGE_HOME}/edge_ui/bokeh.log &
It works fine for a while, approximately a day or so, before it unexpectedly stops responding. Here is the output from our log file:
2018-01-03 22:04:47,696 200 GET /pangia-vis?r=pangia-vis/data/6385dcf0180011304a1cc3b47512c6a6.tsv (127.0.0.1) 17.70ms
2018-01-03 22:04:49,867 WebSocket connection opened
2018-01-03 22:04:49,868 ServerConnection created
2018-01-03 22:05:13,278 WebSocket connection closed: code=1001, reason=None
2018-01-03 22:05:24,960 Error running application handler <bokeh.application.handlers.directory.DirectoryHandler object at 0x2aaac3e56fd0>: ‘NoneType’ object is not iterable
File “main.py”, line 38, in :
get_params = sorted(get_params) Traceback (most recent call last):
File “/panfs/biopan01/edge_prod/thirdParty/Anaconda3/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py”, line 81, in run
exec(self._code, module.dict)
File “/panfs/biopan01/edge_prod/thirdParty/pangia/pangia-vis/main.py”, line 38, in
get_params = sorted(get_params)
TypeError: ‘NoneType’ object is not iterable
It seems that the WebSocket closes and so the session data is lost. I can’t find any reason for why this happens; viewing the same plot that worked before will encounter the closed WebSocket later on. Once we restart the bokeh server everything is fine. Is it a version issue with on of the python libraries?
Is there some way to query the WebSocket status? If so, I could run it inside a supervisor daemon and have it restart the server if the websocket is closed.
$ ./pip list | grep -i ‘jinja|numpy|six|requests|tornado|pyyaml|dateutil|bokeh’
bokeh (0.12.4)
Jinja2 (2.8)
numpy (1.11.1)
numpydoc (0.6.0)
python-dateutil (2.5.3)
PyYAML (3.11)
requests (2.10.0)
six (1.10.0)
sockjs-tornado (1.0.3)
tornado (4.3)
CentOS Linux release 7.2.1511 (Core)
relevant snippet from main.py
import pandas as pd
import numpy as np
import sys
from os.path import dirname, join, isfile
from bokeh.plotting import curdoc, figure
from bokeh.layouts import row, layout, widgetbox, column
from bokeh.models import ColumnDataSource, HoverTool, Div, FactorRange, Range1d, TapTool, CustomJS
from bokeh.models.widgets import Button, Slider, Select, TextInput, RadioButtonGroup, DataTable, TableColumn, NumberFormatter
from bokeh.models.callbacks import CustomJS
from bokeh.palettes import RdYlBu11
default cutoffs for dot-plot display
def_val_patho = 0 #display mode: 0 → pathogen only, 1 → all
def_val_min_len = 50 #Minimum linear length [0-500] step=1
def_val_min_cov = 0.1 #Minimum linear coverage [0-1] step=0.01
def_val_max_r_raw = 100 #Minimum reads [0-500] step=1
def_val_max_r_rsnb = 100 #Minimum reads [0-100] step=1
def_val_min_score = 0.5 #Minimum score [0-1] step=0.1
get pangia result tsv
args = curdoc().session_context.request.arguments
r_file = “”
if len(sys.argv) > 1:
r_file = sys.argv[1]
sys.stderr.write("[INFO] "+r_file)
if isfile(r_file):
sys.stderr.write("[INFO] Input file by sys argv: " + r_file)
else:
sys.stderr.write("[ERROR] Input file by sys argv: not found.")
raise
if not r_file:
try:
get_params = args.get(‘r’)
get_params = sorted(get_params)
``