def BokehApplication(applications, server, prefix="/", template_variables={}): prefix = prefix or "" prefix = "/" + prefix.strip("/") if not prefix.endswith("/"): prefix = prefix + "/" extra = toolz.merge({"prefix": prefix}, template_variables) apps = { k: functools.partial(v, server, extra) for k, v in applications.items() } apps = {k: Application(FunctionHandler(v)) for k, v in apps.items()} kwargs = dask.config.get( "distributed.scheduler.dashboard.bokeh-application").copy() extra_websocket_origins = create_hosts_whitelist( kwargs.pop("allow_websocket_origin"), server.http_server.port) application = BokehTornado( apps, prefix=prefix, use_index=False, extra_websocket_origins=extra_websocket_origins, **kwargs, ) return application
def BokehApplication(applications, server, prefix="/", template_variables={}): prefix = "/" + prefix.strip("/") + "/" if prefix else "/" extra = {"prefix": prefix, **template_variables} funcs = {k: functools.partial(v, server, extra) for k, v in applications.items()} apps = {k: Application(FunctionHandler(v)) for k, v in funcs.items()} kwargs = dask.config.get("distributed.scheduler.dashboard.bokeh-application").copy() extra_websocket_origins = create_hosts_allowlist( kwargs.pop("allow_websocket_origin"), server.http_server.port ) return BokehTornado( apps, prefix=prefix, use_index=False, extra_websocket_origins=extra_websocket_origins, **kwargs, )