Skip to main content

openhpc_webui

openhpc_webui 是面向高校、科研机构和企业智算中心的轻量级中文管理门户。项目将 OpenLDAP 身份管理、Slurm 账户与关联、分区和节点配置、作业状态及输出查看集中到同一个 Web 界面,适合内网和离线环境。

当前版本:0.2.0

功能概览

模块 主要能力
系统总览 LDAP 用户数、活动作业、空闲节点、近期作业和分区状态
用户管理 LDAP 用户增删改、禁用、SSH 密钥、存储配额、核时/卡时和作业报表
组管理 LDAP 组创建、编辑、删除及成员信息查看
账户管理 Slurm 账户创建、编辑和删除
集群用户 Slurm Association、QOS、默认 QOS、分区和 TRES Minutes 管理
分区管理 Slurm 分区配置、节点状态统计及配置重载
节点管理 节点配置维护、Drain、Resume 和状态查看
作业管理 活动作业、近期完成作业、详情、取消及标准输出/错误查看
权限管理 门户管理员授权与撤销

页面资源随项目提供,不依赖外部 CDN。列表采用固定表头、对齐的数字和状态列,并在内容溢出时提供横向滚动。

权限模型

能力 管理员 普通用户
系统总览和管理页面 是 否
查看全部活动及近期完成作业 是 是
查看作业详情 是 是
查看作业输出 任意作业 仅自己的作业
取消作业 任意作业 仅自己的作业
修改自己的 LDAP 密码 是 是

管理员由 ADMIN_USERS 配置,也可以在权限管理页面在线维护。普通用户访问管理员页面时会被重定向到作业页面。

界面预览

登录

openhpc_webui 登录界面

系统总览

openhpc_webui 系统总览

用户管理

openhpc_webui 用户管理

作业管理

openhpc_webui 作业管理

技术栈

  • Python 3.9+
  • FastAPI、Jinja2 和 Uvicorn
  • ldap3 / OpenLDAP
  • Slurm CLI:sinfo、squeue、sacct、scontrol、sacctmgr、scancel
  • uv 依赖与环境管理
  • Tailwind CSS CLI 4.x(仅在修改模板或前端脚本中的工具类后重新构建)

项目结构

openhpc_webui/
├── openhpc_webui/
│   ├── application.py      # FastAPI 路由与接口
│   ├── cli.py              # 命令行入口
│   ├── core/               # 配置、认证和公共能力
│   ├── models/             # 请求与响应模型
│   └── services/           # LDAP、Slurm 和系统集成
├── templates/              # Jinja2 页面模板
├── static/                 # 离线 CSS、JavaScript 和图标
├── tests/                  # 自动化测试
├── docs/                   # 使用、部署和运维文档
├── env.example             # 环境变量示例
└── pyproject.toml          # 项目元数据与依赖

环境要求

运行门户的主机需要:

  • 能够访问 OpenLDAP 服务;
  • 安装 Slurm 客户端命令,并能连接 Slurm 控制端;
  • 对节点和分区配置文件具有业务所需的读写权限;
  • 使用 NFS 配额时安装并配置 quota / setquota;
  • 生产环境具备 Nginx、Supervisor 或等效的进程管理能力。

Web 管理员身份不会绕过 Linux 文件权限或 Slurm 权限。

快速开始

uv sync
cp env.example .env
uv run uvicorn openhpc_webui.application:app --reload --port 6827

浏览器访问 http://127.0.0.1:6827。也可以使用项目命令启动监听在 0.0.0.0:6827 的服务:

uv run openhpc_webui

最小配置

编辑 .env,至少确认以下配置:

配置项 用途
LDAP_URI LDAP 服务地址
LDAP_BASE_DN LDAP Base DN
LDAP_DEFAULT_BIND_DN 管理 Bind DN
LDAP_DEFAULT_AUTHTOK 管理 Bind 密码
SECRET_KEY Session 签名密钥,生产环境不少于 32 个随机字符
AUTHORIZED 是否启用登录认证,生产环境必须为 True
ADMIN_USERS 管理员用户名,多个值使用英文逗号分隔
SLURM_DEFAULT_ACCOUNT 创建 LDAP 用户时使用的默认 Slurm 账户
SLURM_CONFIG_DIR 节点与分区配置文件目录,默认 /etc/slurm

完整配置说明见技术指南。

生产部署

生产环境建议由 Supervisor 管理 Uvicorn,并仅监听 127.0.0.1:6827;由 Nginx 提供 HTTPS 和反向代理。不要直接将开发服务器暴露到公网。

部署步骤、自签发证书、服务管理和升级方法见生产部署指南。

文档

验证与开发

./scripts/build_tailwind.sh
uv run python -m unittest discover -s tests
uv run python -m compileall -q openhpc_webui

Tailwind 构建入口为 tailwind.css,只扫描 templates/ 和 static/*.js 中实际使用的类,并将压缩后的离线样式写入 static/all-tailwind-classes-full-min.css。

提交界面变更前,还应手动检查登录、用户、组、账户、集群用户、分区、节点、作业和权限页面,并附上桌面与窄屏截图。

安全建议

  • 仅在受控内网开放门户,并使用防火墙限制来源。
  • 生产环境启用 HTTPS,并将 SESSION_HTTPS_ONLY 设为 True。
  • 不要提交 .env、LDAP 管理密码、Session 密钥或真实用户数据。
  • 仅授予运行账户完成 LDAP、Slurm 和配置文件操作所需的最小权限。
  • 定期审计管理员列表、Slurm 操作和应用日志。

本项目是集群管理辅助工具,不替代 Slurm、LDAP、监控平台或审计系统本身。

Metadata

Release files for openhpc-webui 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openhpc-webui 0.2.0
File Size Uploaded Provenance
openhpc_webui-0.2.0.tar.gz 1.0 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openhpc-webui 0.2.0
File Interpreter ABI Platform
openhpc_webui-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / openhpc_webui-0.2.0.tar.gz

Download URL openhpc_webui-0.2.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
b36e967be8127ec6fd65e184bc8ea44b5471ae88c715260617770c0ee9daffcf
BLAKE2b-256 checksum
How to use checksums
04545111540a0ec2dd8e485326d536bbab4917b29006353f1803709d88c6e35e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / openhpc_webui-0.2.0-py3-none-any.whl

Download URL openhpc_webui-0.2.0-py3-none-any.whl
Size 171.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8560c9b0e64f0c247bdee2366c6e93e3290be63291832588b1fc314e21a0f3e
BLAKE2b-256 checksum
How to use checksums
ada0b65ba580281b73ac80c51b725de2ffca6c2ae9160844ad058428bc7a2577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Security for openhpc-webui 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openhpc_webui-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page