跳转到主要内容

为Jug提供带资源管理的自动DRMAA调度

项目描述

jug_schedule 是一个 jug 子命令,它提供了自动部署到队列系统的功能。
目前支持 SGE/GE(网格引擎)、LSF(IBM LSF)和 SLURM

该项目目前处于实验阶段,因此欢迎提交错误报告。

需求

该项目依赖于 drmaa 以及显然的 jug

安装

使用以下命令安装 jug_schedule

pip install jug-schedule

或使用Anaconda安装

conda install -c unode jug-schedule

然后只需将以下内容添加到您的 ~/.config/jug/jug_user_commands.py

try:
    from jug_schedule.schedule import ScheduleCommand
    schedule = ScheduleCommand()
except Exception as e:
    import sys
    sys.stderr.write("Couldn't import schedule, error was {0}\n".format(e))

如果您直接从git运行,则可以使用以下命令

import sys

sys.path.insert(0, "/path/to/clone/of/jug_schedule/")

try:
    from jug_schedule.schedule import ScheduleCommand
    schedule = ScheduleCommand()
except Exception as e:
    sys.stderr.write("Couldn't import schedule, error was {0}\n".format(e))

用法

如果安装正确,现在运行 jug 应该包括一个 schedule 子命令。

运行它将尝试检测队列系统并将其作业提交到该系统。 jug schedule 将仅产生警告和错误。使用 --verbose debug 以获取详细消息。

jug 状态 将按常规行为运行,并推荐用于检查执行进度。

脚本

如果你的系统需要在远程服务器上运行 jug 而需要额外设置,则需要使用 –script 选项。脚本应该使用所有给定的参数调用 jug。例如

#!/usr/bin/env bash

# Enabling modules (http://modules.sourceforge.net/) in the current shell
if [ -f /etc/profile.d/modules.sh ]; then
    source /etc/profile.d/modules.sh
fi

# Loading (ana)conda
module add conda
# and an environment called py3 where jug was installed
source activate py3

# Then calling jug with all given arguments. Make sure to keep the quotes on $@
jug "$@"

假设上面的内容已保存到文件 script.helper 中,然后你可以调用

jug schedule --script script.helper

如果你给它与你的 jugfile 相同的名称,它将自动加载

$ ls
myjugfile.helper myjugfile.py
$ jug schedule myjugfile.py  # <- will use myjugfile.helper

配置

jug_schedule 依赖于 DRMAA 与队列系统的交互。

DRMAA 的支持有限,并且在不同平台上的质量差异很大。
目前支持的平台包括 LSFSGESLURM

为了使用 jug_schedule,你的环境需要定义 DRMAA_LIBRARY_PATH。如果运行 env | grep DRMAA_LIBRARY_PATH 没有匹配项,请向你的系统管理员询问此库的位置。

然后使用

export DRMAA_LIBRARY_PATH=/path/to/libdrmaa.so

你只需在运行 jug schedule 的环境中设置此选项。

资源

jug_schedule 的另一个附加功能是能够定义作业资源。

如果你已经了解 jug 的 TaskGenerator 装饰器,你可以简单地将其替换为以下内容(在适用的情况下)

from jug_schedule.resources import ResourcesTaskGenerator

@ResourcesTaskGenerator(cpu=10, mem=100, queue="default")
def func(...):
    ...

支持的参数包括:cpumem(以 MB 为单位)、queuecustom 以用于任意选项。

命令行选项

以下选项是可用的

--script            - command used to run jug on the cluster. Point this to a shell script if you need to setup jug's environment prior to execution
--max-jobs          - how big is the pool of jug jobs (max number of simultaneous jobs)
--max-array         - when submitting jobs to the queue system, limit the maximum number of jobs per submission
--logs              - where to write job logs. Defaults to a directory 'jug_logs' in the current directory.
--cycle-time        - how many seconds to wait between every interaction with the queue system. Defaults to 60
--stop-on-error     - jug_schedule will continue until all jobs fail. Default is to continue queueing jobs when a job fails.
--recycle           - when a job fails, instead of removing one job from the pool, recycle it and keep the pool size constant.

项目详情


下载文件

下载适合你平台的电影。如果你不确定要选择哪个,了解更多关于 安装包 的信息。

源分发

jug_schedule-0.4.2.tar.gz (16.0 kB 查看哈希值

上传

构建分发

jug_schedule-0.4.2-py2.py3-none-any.whl (18.5 kB 查看哈希值

上传 Python 2 Python 3

支持者