跳转到主要内容

调度工具用于在调度器(例如SLURM)上创建相互依赖的任务

项目描述

scheduler_tools

Build Status Documentation Code Coverage

调度工具用于在调度器(例如SLURM)上创建相互依赖的任务


在集群上从您的本地桌面启动prefect / dask-distributed的设置要求

在您的本地系统上

对于您正在进行的任何项目,将调度工具添加到您的依赖列表中。

conda activate {your_env_name}
pip install -e {your_project_name}
mkdir ~/.aics_dask

创建文件 ~/.aics_dask/ssh.json,内容如下

{"gateway":{
	"url": "slurm-machine.bettertech.com",
	"user": "flanders",
	"identityfile": "/Users/flanders/ssh/flandersPrivateKey"
	},
    "dashboard_port": 8787,
    "dask_port": 34009
}

在集群上

conda activate {your_env_name}
pip install -e {your_project_name}
mkdir ~/.aics_dask

编程启动远程服务器并创建隧道

from scheduler_tools import Connector
from pathlib import Path

prefs = {'gateway': {}}
prefs['gateway']['url'] = 'slurm-machine.bettertech.com'
prefs['gateway']['user'] = 'flanders'
prefs['gateway']['identityfile'] = '~/.ssh/id_rsa'
prefs['dask_port'] = 34009
prefs['dashboard_port'] = 8787


dask_prefs = {'cluster_obj_name': {'module': 'dask_jobqueue', 'object': 'SLURMCluster'},
                      'cluster_conf': {},
                      'worker_conf': {},
                      'remote_conf': {}
                      }
dask_prefs['cluster_obj_name'] = {'module': 'dask_jobqueue', 'object': 'SLURMCluster'}

dask_prefs['cluster_conf']['queue'] = 'aics_cpu_general'
dask_prefs['cluster_conf']['cores'] = 2
dask_prefs['cluster_conf']['memory'] = '4GB'
dask_prefs['cluster_conf']['walltime'] = "02:00:00"
dask_prefs['worker_conf']['minimum_jobs'] = 2
dask_prefs['worker_conf']['maximum_jobs'] = 40

dask_prefs['remote_conf']['env'] = 'dask-scheduler' # whatever you named your remote conda env
dask_prefs['remote_conf']['command'] = 'setup_and_spawn.bash'
dask_prefs['remote_conf']['path'] = '/home/<username>/.aics_dask' # where your preferences live for this


conn = Connector(dask_prefs=dask_prefs, pref_path=Path('~/.aics_dask/ssh.json'))
conn.run_command()
conn.stop_forward_if_running()
conn.forward_ports()

编程关闭远程服务器和隧道

from scheduler_tools import Connector
from pathlib import Path

conn = Connector(pref_path=Path('~/.aics_dask/ssh.json'))
conn.stop_dask()

集群创建上下文示例

from scheduler_tools import Connector, default_dask_prefs
from pathlib import Path

dask_prefs = default_dask_prefs()


with Connector(dask_prefs=dask_prefs, prefs=Path('~/.aics_dask/ssh.json')) as conn:
    print(f"local dashboard on: {conn.local_dashboard_port}")
    print(f"local dask port: {conn.local_dask_port}")
    # !!! your code here !!!

命令行界面

CLI启动Dask集群命令

spawn_dask_cluster -s ~/.aics_dask_gpu/ssh.json -q aics_gpu_general -r <remote_env_name>

CLI停止Dask集群命令

shutdown_dask_cluster -s ~/.aics_dask/ssh.json

免费软件:艾伦研究所软件许可

项目详情


下载文件

下载适合您平台的应用程序。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

scheduler_tools-0.1.5.tar.gz (24.1 kB 查看哈希)

上传时间

构建分发

scheduler_tools-0.1.5-py2.py3-none-any.whl (27.9 kB 查看哈希值)

上传时间: Python 2 Python 3

由以下支持