基于资源管理的jug自动drmaa调度

jug-schedule的Python项目详细描述


jug_schedule是一个jug子命令,为排队系统提供自动部署。
当前支持sge/ge(网格引擎)、lsf(IBM LSF)和slurm

这个项目目前是实验性的,所以bug报告是受欢迎的。

要求

这个项目依赖于drmaa,显然依赖于jug

安装

安装jug_schedule时使用:

pip install jug-schedule

或来自水蟒的:

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))

注意

如果您从未在您的环境中设置过drmaa,请检查下面的configuration部分。

用法

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

运行它将尝试检测排队系统并向其提交作业。 jug schedule只会产生警告和错误。使用--verbose debug查看详细消息。

jug status将照常工作,是检查执行进度的推荐方法。

脚本

如果您的系统需要在远程服务器上运行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的环境中设置此选项。

注意

您还可以使用contrib/find_libdrmaa在系统上找到libdrmaa.so。 有关详细信息,请检查contrib/文件夹中的README

资源

jug_schedule的另一个特性是能够定义作业资源。

如果您已经知道jug的TaskGeneratordecorator,您可以在适用的情况下用以下内容替换它:

from jug_schedule.resources import ResourcesTaskGenerator

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

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

注意

使用custom时,请注意,提供无效或格式错误的选项可能会导致崩溃。 slurm是一个已知的罪犯,据报道是on this issue

命令行选项

提供以下选项:

--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.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java FileHandle在libgdx中的行为异常   java JSONObject文本必须在1[字符2第1行]处以“{”开头,在使用HTTPClient自动化API时出现此错误   java如何删除域下不同路径的所有cookie   项目间的java Log4j共享   java propertyChangeListeners连锁反应,导致溢出   java gradle测试错误:retrolambda。oldJdk   java IDE没有给出错误,但ArrayList无法工作   web服务Java大字符串压缩安全方法   java如何从奥地利ecard将ResponseADU解码为XML?   java RxJava 2将事件并行化以执行,并产生副作用   java在jni的CallStaticObjectMethod的引用上使用DeleteLocalRef   java递归查找字符串中出现的字母数   java为什么SBT想要获得组织。scalasbt是否已安装?   java如何动态地增加布局,并知道用户点击了哪个布局?   条形图上未设置java截击响应数据