当前位置: 首页>>代码示例>>Python>>正文


Python Client.run_on_scheduler方法代码示例

本文整理汇总了Python中dask.distributed.Client.run_on_scheduler方法的典型用法代码示例。如果您正苦于以下问题:Python Client.run_on_scheduler方法的具体用法?Python Client.run_on_scheduler怎么用?Python Client.run_on_scheduler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dask.distributed.Client的用法示例。


在下文中一共展示了Client.run_on_scheduler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cli

# 需要导入模块: from dask.distributed import Client [as 别名]
# 或者: from dask.distributed.Client import run_on_scheduler [as 别名]
def cli(scheduler_file, jlab_port, dash_port, notebook_dir,
        hostname, log_level):
    logger = get_logger(log_level)

    logger.info('getting client with scheduler file: %s' % scheduler_file)
    client = Client(scheduler_file=scheduler_file, timeout=30)
    logger.debug('Client: %s' % client)

    logger.debug('Getting hostname where scheduler is running')
    host = client.run_on_scheduler(socket.gethostname)
    logger.info('host is %s' % host)

    logger.info('Starting jupyter lab on host')
    client.run_on_scheduler(start_jlab, host=host, port=jlab_port,
                            notebook_dir=notebook_dir)
    logger.debug('Done.')

    user = os.environ['USER']
    print('Run the following command from your local machine:')
    #print('ssh -N -L {}:{}:{} -L {}:{}:8787 {}@{}'.format(jlab_port, host, jlab_port, dash_port, host, user, hostname))
    print('ssh -N -L {}:{}:{} -L {}:{}:8787 {}'.format(jlab_port, host, jlab_port, dash_port, host,  hostname)) #Modification for existing ssh key
    print('Then open the following URLs:')
    print('\tJupyter lab: http://localhost:{}'.format(jlab_port))
    print('\tDask dashboard: http://localhost:{}'.format(dash_port))
开发者ID:jbusecke,项目名称:server_setup,代码行数:26,代码来源:setup-jlab.py

示例2: Client

# 需要导入模块: from dask.distributed import Client [as 别名]
# 或者: from dask.distributed.Client import run_on_scheduler [as 别名]
from dask.distributed import Client
import socket

client = Client(scheduler_file='scheduler.json')
print(client)

host = client.run_on_scheduler(socket.gethostname)


def start_jlab(dask_scheduler):
    import subprocess
    proc = subprocess.Popen(['jupyter', 'notebook', '--ip', host])
    dask_scheduler.jlab_proc = proc


client.run_on_scheduler(start_jlab)

print("HOST : %s" % host)
开发者ID:jbusecke,项目名称:server_setup,代码行数:20,代码来源:start_notebook.py


注:本文中的dask.distributed.Client.run_on_scheduler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。