xenon api的python包装器。
pyxenon的Python项目详细描述
python到Xenon middleware library, v. 2.0的接口。Xenon提供了一个简单的编程 与可用于访问分布式 计算和存储资源。
下面使用GRPC,连接到Xenon-GRPC服务。 我们已经注意在这个python模块中镜像原始的java api 尽可能的。
安装
克隆此存储库,并执行以下操作:
pip install .
当代码准备好发布时,它将出现在pypi上。
文档
编译的文档位于Read the Docs上。这包括一个快速的开始 引导。
开发
pyxenon附带xenon grpcjar文件和命令行可执行文件。如果 这些需要升级,手动构建,按照 Xenon-GRPC,并将 build/install/xenon-grpc-shadow文件夹(lib和bin)在这里。
要生成grpc代码,请从项目根目录运行scripts/protoc.sh。
测试
单元测试都是针对 文件系统。要运行它们,请执行以下操作:
$ pytest ./tests
为了更快地进行测试,启动xenon-grpc守护进程可能很有用 手动;在单独的终端中启动,因为它可能为 调试。
对于集成测试,运行以下Docker容器来测试 远程泥泞
docker run --detach --publish 10022:22 nlesc/xenon-slurm:17
针对此容器运行的某些代码的示例位于 examples/tutorial.py。
示例
importxenonfrompathlibimportPathimportosxenon.init()# create a new job scheduler, using SSH to localhost to submit new jobs.withxenon.Scheduler.create(adaptor='ssh',location='localhost')asscheduler:# 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 jobjob=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.withopen(target)asf:print(f.read())
贡献
可以使用github pull请求进行贡献。要添加功能, 首先安装测试要求
pip install -U tox
然后运行
tox
直到所有测试成功。该命令检查flake8代码 python 3.5和3.6上的标准和语法错误。然后承诺,确保 更改没有破坏任何代码。将在中评估拉取请求 Travis。