當前位置: 首頁>>代碼示例>>Python>>正文


Python embed.server_document方法代碼示例

本文整理匯總了Python中bokeh.embed.server_document方法的典型用法代碼示例。如果您正苦於以下問題:Python embed.server_document方法的具體用法?Python embed.server_document怎麽用?Python embed.server_document使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bokeh.embed的用法示例。


在下文中一共展示了embed.server_document方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def get(self, session_id, graph_key):
        session_name = session_id

        template = _jinja_env.get_template('task_pages/progress.html')
        task_progress_script = server_document(
            '%s://%s/%s' % (self.request.protocol, self.request.host, PROGRESS_APP_NAME),
            arguments=dict(session_id=session_id, task_id=graph_key))
        self.write(template.render(
            session_id=session_id,
            session_name=session_name,
            task_id=graph_key,
            task_progress_script=task_progress_script,
        )) 
開發者ID:mars-project,項目名稱:mars,代碼行數:15,代碼來源:task_pages.py

示例2: get

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def get(self, endpoint):
        template = _jinja_env.get_template('worker_pages/timeline.html')
        worker_timeline_script = server_document(
            '%s://%s/%s' % (self.request.protocol, self.request.host, TIMELINE_APP_NAME),
            arguments=dict(endpoint=endpoint))
        self.write(template.render(
            endpoint=endpoint,
            host_name=_worker_host_cache.get(endpoint, endpoint),
            worker_timeline_script=worker_timeline_script,
        )) 
開發者ID:mars-project,項目名稱:mars,代碼行數:12,代碼來源:worker_pages.py

示例3: sliders

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def sliders(request):
    return render(request, 'base.html', {
        "server_script": server_document('http://%s:%s/bk_sliders_app'%(bk_config.server['address'],
                                                                        bk_config.server['port']))}) 
開發者ID:ioam,項目名稱:parambokeh,代碼行數:6,代碼來源:views.py

示例4: get

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def get(self):
        print("index ...")
        template = env.get_template('bokeh_embed.html')
        script = server_document(server_url + 'bkapp')
        print(script)
        self.write(template.render(script=script, template="Tornado"))
        # self.write(html_content) 
開發者ID:pythonstock,項目名稱:stock,代碼行數:9,代碼來源:tornado_bokeh_embed.py

示例5: __init__

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def __init__(self):
        print("creating new app")
        self.flask_app = Flask('__main__') # use '__main__' because this script is the top level

        # GET routine for root page
        @self.flask_app.route('/', methods=['GET'])  # going to http://localhost:5006 or whatever will trigger this route
        def bkapp_page():
            script = server_document(url='http://localhost:5006/bkapp')
            return render_template('index.html', script=script) 
開發者ID:pysdr,項目名稱:pysdr,代碼行數:11,代碼來源:pysdr_app.py

示例6: index

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def index():
	# format
	# name-of-js-to-add = server_document(url="http://localhost:5006/<py file that generate the graph and updates it>")
    
    client_demo_script=server_document(url="http://localhost:5006/client_demo")
    # script2=server_document(url="http://localhost:5006/update2")
    return render_template('client-demo.html', client_plot=client_demo_script) 
開發者ID:wywongbd,項目名稱:pairstrade-fyp-2019,代碼行數:9,代碼來源:server_demo.py

示例7: sliders

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def sliders(request: HttpRequest) -> HttpResponse:
    script = server_document(request.build_absolute_uri())
    return render(request, "base.html", dict(script=script)) 
開發者ID:holoviz,項目名稱:panel,代碼行數:5,代碼來源:views.py

示例8: gbm

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def gbm(request: HttpRequest) -> HttpResponse:
    script = server_document(request.build_absolute_uri())
    return render(request, "gbm/gbm.html", dict(script=script)) 
開發者ID:holoviz,項目名稱:panel,代碼行數:5,代碼來源:views.py

示例9: stockscreener

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def stockscreener(request: HttpRequest) -> HttpResponse:
    script = server_document(request.build_absolute_uri())
    return render(request, "stockscreener/stockscreener.html", dict(script=script)) 
開發者ID:holoviz,項目名稱:panel,代碼行數:5,代碼來源:views.py

示例10: sliders

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def sliders(request: HttpRequest) -> HttpResponse:
    script = server_document(request.build_absolute_uri())
    return render(request, "sliders/sliders.html", dict(script=script)) 
開發者ID:holoviz,項目名稱:panel,代碼行數:5,代碼來源:views.py

示例11: bokeh_row

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def bokeh_row(request, job_id, type='individual-graph'):
    """
    Returns an embeded bokeh document in json. Javascript can use this method to inject bokeh document to jobs table.
    """
    try:
        job = TethysJob.objects.get_subclass(id=job_id)
        status = job.status

        # Get dashboard link for a given job_id
        scheduler_id = job.scheduler_id
        dask_scheduler = DaskScheduler.objects.get(id=scheduler_id)
        base_link = dask_scheduler.dashboard

        # Append http if not exists
        if 'http' not in base_link:
            base_link = 'http://' + base_link

        # Add forward slash if not exist
        if base_link[-1] != '/':
            base_link = base_link + '/'

        # use bokeh server_document to embed
        url_link = base_link + type
        script = server_document(url_link)

        context = {"the_script": script}
        success = True

    except Exception as e:
        log.error('The following error occurred when getting bokeh chart '
                  'from scheduler {} for job {}: {}'.format(dask_scheduler.name, job_id, str(e)))
        return

    # Render bokeh app into a string to pass in JsonResponse
    html = render_to_string('tethys_gizmos/gizmos/bokeh_application.html', context)
    return JsonResponse({'success': success, 'status': status, 'html': html}) 
開發者ID:tethysplatform,項目名稱:tethys,代碼行數:38,代碼來源:jobs_table.py

示例12: show_server

# 需要導入模塊: from bokeh import embed [as 別名]
# 或者: from bokeh.embed import server_document [as 別名]
def show_server(panel, notebook_url, port):
    """
    Displays a bokeh server inline in the notebook.

    Arguments
    ---------
    panel: Viewable
      Panel Viewable object to launch a server for
    notebook_url: str
      The URL of the running Jupyter notebook server
    port: int (optional, default=0)
      Allows specifying a specific port
    server_id: str
      Unique ID to identify the server with

    Returns
    -------
    server: bokeh.server.Server
    """
    from IPython.display import publish_display_data

    if callable(notebook_url):
        origin = notebook_url(None)
    else:
        origin = _origin_url(notebook_url)
    server_id = uuid.uuid4().hex
    server = get_server(panel, port=port, websocket_origin=origin,
                        start=True, show=False, server_id=server_id)

    if callable(notebook_url):
        url = notebook_url(server.port)
    else:
        url = _server_url(notebook_url, server.port)

    script = server_document(url, resources=None)

    publish_display_data({
        HTML_MIME: script,
        EXEC_MIME: ""
    }, metadata={
        EXEC_MIME: {"server_id": server_id}
    })
    return server 
開發者ID:holoviz,項目名稱:panel,代碼行數:45,代碼來源:notebook.py


注:本文中的bokeh.embed.server_document方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。