跳转到主要内容

带有头节点的PBS和SLURM集群客户端包。

项目描述

hpc05

Conda Downloads docs version PyPI - Python Version

🖥 ipyparallel.Client 包,用于带有头节点的PBS或SLURM集群。

通过ssh连接到带有头节点的PBS或SLURM集群的脚本。由于ipyparallel不会在引擎不活动时销毁引擎,并且人们很懒(因为他们忘记使用qdel来删除他们的作业),因此它会在设置的超时时间后自动杀死ipengines(默认=15分钟)。请注意,此包不仅适用于TU Delft的hpc05集群,也适用于其他集群。

安装

首先在您的机器和集群上安装此包。

conda config --add channels conda-forge
conda install hpc05

或使用pip

pip install hpc05

确保您可以通过复制ssh密钥无密码地通过ssh连接

ssh-copy-id hpc05

设置配置文件

您需要在集群上有一个并行配置文件,这可以通过在本地机器上以下命令创建

import hpc05
# for PBS use
hpc05.create_remote_pbs_profile(profile='pbs', hostname='hpc05')  # on the remote machine
# or
hpc05.create_local_pbs_profile(profile='pbs')  # on the cluster

# for SLURM use
hpc05.create_remote_slurm_profile(profile='slurm', hostname='hpc05')  # on the remote machine
# or
hpc05.create_local_slurm_profile(profile='slurm')  # on the cluster

启动ipcluster并连接(通过ssh

要启动并连接到ipcluster,只需这样做(如果有错误消息,请阅读错误消息以获取说明)

client, dview, lview = hpc05.start_remote_and_connect(
	n=100, profile='pbs', hostname='hpc05', folder='~/your_folder_on_the_cluster/')

这相当于以下三个命令

# 0. Killing and removing files of an old ipcluster (this is optional with
#    the `start_remote_and_connect` function, use the `kill_old_ipcluster` argument)
hpc05.kill_remote_ipcluster(hostname='hpc05')

# 1. starting an `ipcluster`, similar to running
#    `ipcluster start --n=100 --profile=pbs` on the cluster headnode.
hpc05.start_remote_ipcluster(n=100, profile='pbs', hostname='hpc05')

# 2. Connecting to the started ipcluster and adding a folder to the cluster's `PATH`
client, dview, lview = hpc05.connect_ipcluster(
	n=200, profile='pbs', hostname='hpc05', folder='~/your_folder_on_the_cluster/')

启动ipcluster并连接(在集群头节点上)

要启动并连接到ipcluster,只需这样做(如果有错误消息,请阅读错误消息以获取说明)

client, dview, lview = hpc05.start_and_connect(
	n=100, profile='pbs',  folder='~/your_folder_on_the_cluster/')

这相当于以下三个命令

# 0. Killing and removing files of an old ipcluster (this is optional with
#    the `start_remote_and_connect` function, use the `kill_old_ipcluster` argument)
hpc05.kill_ipcluster()

# 1. starting an `ipcluster`, similar to `ipcluster start --n=200 --profile=pbs`
hpc05.start_ipcluster(n=200, profile='pbs')

# 2. Connecting to the started ipcluster and adding a folder to the cluster's `PATH`
client, dview, lview = hpc05.connect_ipcluster(
	n=200, profile='pbs', folder='~/your_folder_on_the_cluster/')

监控资源

如果您使用hpc05_monitor.start(client)启动它,此包将监控您的资源,请参阅以下示例使用

import time
import hpc05_monitor
hpc05_monitor.start(client, interval=5)  # update hpc05_monitor.MAX_USAGE every 'interval' seconds.

while not hpc05_monitor.LATEST_DATA:
    time.sleep(1)

hpc05_monitor.print_usage()  # uses hpc05_monitor.LATEST_DATA by default

hpc05_monitor.print_max_usage()  # uses hpc05_monitor.MAX_USAGE

输出

 id hostname             date                             CPU% MEM%
 15 node29.q1cluster     2018-09-10T14:25:05.350499       190%   3%
 19 node29.q1cluster     2018-09-10T14:25:04.860693       200%   3%
 26 node29.q1cluster     2018-09-10T14:25:05.324466       200%   3%
 28 node29.q1cluster     2018-09-10T14:25:05.148623       190%   2%
 29 node29.q1cluster     2018-09-10T14:25:04.737664       190%   3%
 ...

开发

我们使用pre-commit进行代码的代码审查,因此请运行以下命令在存储库中

pre-commit install

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码发行版

hpc05-2.0.6.tar.gz (19.3 kB 查看哈希值)

上传时间 源代码

构建发行版

hpc05-2.0.6-py3-none-any.whl (20.5 kB 查看哈希值)

上传时间 Python 3

由以下支持