跳转到主要内容

用于Xenon API的Python封装。

项目描述

ZenodoBadge Documentation Status Apache2License BuildStatus CodacyBadge

Python接口到Xenon中间件库,v. 3.0。Xenon提供了一个简单的编程接口,可以用于访问分布式计算和存储资源。

它下面使用GRPC连接到Xenon-GRPC服务。我们已经尽可能地在Python模块中反映了原始Java API。

安装

克隆此存储库,并执行以下操作

pip install .

代码将在准备发布时出现在PyPI上。

文档

编译的文档托管在Read the Docs上。这包括快速入门指南。

示例

import xenon
from pathlib import Path
import os

xenon.init()

# create a new job scheduler, using SSH to localhost to submit new jobs.
with xenon.Scheduler.create(
        adaptor='ssh', location='localhost') as scheduler:

    # make a new job description. The executable must already be present on
    # the target host.
    target = Path('.') / 'stdout.txt'
    desc = xenon.JobDescription(
        executable='hostname',
        stdout=str(target.resolve()))

    # submit a job
    job = scheduler.submit_batch_job(desc)
    status = scheduler.wait_until_done(job, 1000)

    # read the standard output of the job. We can do this directly because
    # we ran on localhost, otherwise, we need to transfer the file first.
    with open(target) as f:
        print(f.read())

开发

PyXenon附带Xenon-GRPC jar 文件和命令行可执行文件。如果需要升级,请按照Xenon-GRPC中的说明手动构建它们,并将build/install/xenon-grpc-shadow文件夹(libbin)的内容放在此处。

要生成GRPC代码,请在项目根目录中运行scripts/protoc.sh

升级Xenon-GRPC的步骤

xenon-grpc存储库中运行

./gradlew shadowJar

更新的 JAR 文件将位于 ./build/libs/xenon-grpc-${version}.jar。同时确保从 ./build/install/xenon-grpc/bin 复制更新的二进制文件。目标文件应放入 pyxenon 仓库中的 ./bin./lib 文件夹。

更新 ./xenon/versions.py

要更新 GRPC Python 绑定,运行 ./scripts/protoc.sh 脚本。

要更新 Xenon 适配器文档,首先 pip install --upgrade .,然后运行 python ./scripts/print_adaptor_docs.py > docs/adaptors.rst

在将任何内容推回 github 之前,请运行 tox

测试

单元测试都是在针对 本地 调度器和 文件 适配器进行的。要运行它们,只需做

$ pytest ./tests

为了加快测试速度,可能需要手动启动 xenon-grpc 守护进程;在单独的终端中启动它,因为它可能提供有用的调试输出。

对于集成测试,运行以下 docker 容器以测试远程 slurm

docker run --detach --publish 10022:22 nlesc/xenon-slurm:17

一些示例代码在 examples/tutorial.py 中运行针对此容器。

贡献

可以通过 GitHub pull 请求进行贡献。要添加功能,首先安装测试需求

pip install -U tox

然后运行

tox

直到所有测试成功。该命令检查 flake8 代码标准和 Python 3.5 和 3.6 中的语法错误。然后提交,以确保更改没有破坏任何代码。拉取请求将在 Travis 上进行评估。

项目详情


下载文件

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

源分布

pyxenon-3.0.3.tar.gz (22.2 MB 查看哈希值)

上传时间

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面