简体   繁体   English

python bokeh 2.0.0 不渲染

[英]python bokeh 2.0.0 does not render

I recently updated bokeh from 1.4 to 2.0.0.我最近将散景从 1.4 更新到 2.0.0。 I have a flask application with several bokeh servers.我有一个带有多个散景服务器的烧瓶应用程序。 After updating, the bokeh servers no longer render properly(no plot, blank), there are no errors in the browser console or redhat shell.更新后,散景服务器不再正确渲染(无绘图,空白),浏览器控制台或 redhat shell 中没有错误。 If I revert back to bokeh 1.4 + tornado 4.5.3, it renders normally.如果我恢复到散景 1.4 + 龙卷风 4.5.3,它会正常呈现。 Can someone help me figure out what's happening?有人可以帮我弄清楚发生了什么吗?

Python 3.6.3 bokeh 2.0.0 tornado 6.0.4 redhat 4.8.5 Python 3.6.3 散景 2.0.0 龙卷风 6.0.4 红帽 4.8.5

edit: doing bokeh serve myapp.py individually for each bokeh server surprisingly works, it must be the way i'm deploying them through flask..the code below works on bokeh1.4 + tornado 4.5.3编辑:为每个散景服务器单独做bokeh serve myapp.py令人惊讶的工作,这一定是我通过烧瓶部署它们的方式..下面的代码适用于 bokeh1.4 + tornado 4.5.3

# cycle through bokeh files and start bokeh servers
files = []
boks = []
for file in os.listdir("/mypath_to_bokeh/bokehs/"):
    if file.endswith('.py'):
        boks.append(file)
        file = "bokehs/" + file
        files.append(file)
boks = [os.path.splitext(x)[0] for x in boks]

argvs = {}
urls = []
for i in files:
    argvs[i] = None
    urls.append(i.split('\\')[-1].split('.')[0])
host = 'myhost'

apps = build_single_handler_applications(files, argvs)

bokeh_tornado = BokehTornado(apps, extra_websocket_origins=["hoststring"]) 
bokeh_http = HTTPServer(bokeh_tornado)                    
sockets, port = bind_sockets("ipstring", 0) 
bokeh_http.add_sockets(sockets)

def serve(name):
    @app.route("/{}".format(name), endpoint=str(name))
    #@login_required
    #@bokeh_access
    def func():
        bokeh_script = server_document("ipstring:%d/%s" % (port, name)) 
        gc.collect()
        return render_template("bokserv.html", bokeh_script=bokeh_script)

    func.__name__ = name
    gc.collect()
    return func

all_serve_functions = [serve(name) for name in boks]

something I accidentally omitted from the posted code was that I had at the end of my application:我不小心从发布的代码中遗漏了一些我在申请结束时的内容:

def bk_worker():
    asyncio.set_event_loop(asyncio.new_event_loop())
    bokeh_tornado = BokehTornado(apps, extra_websocket_origins=["localhost:8000"]) 
    bokeh_http = HTTPServer(bokeh_tornado)                     
    sockets, port = bind_sockets("localhost", 0) #PROBLEM LINE
    bokeh_http.add_sockets(sockets)
    server = BaseServer(IOLoop.current(), bokeh_tornado, bokeh_http)
    server.start()
    server.io_loop.start()

t = Thread(target=bk_worker)
t.daemon = True
t.start()

Extracting out the #PROBLEM LINE and putting it before the bk_worker() function returned functionality of bokeh for the most part, now it's time to refactor all the deprecated code.提取#PROBLEM LINE并将其放在bk_worker()函数之前返回散景的大部分功能,现在是重构所有弃用代码的时候了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM