本文整理汇总了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))
示例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)