Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

安装

运行要求

  • Linux 或 WSL
  • cargo 的 Rust toolchain
  • 如果希望自动管理 daemon,则需要 systemd --user
  • 如果希望自动检测 GPU,则需要 nvidia-smi

克隆仓库

git clone https://github.com/ymgaq/slotd.git
cd slotd

使用附带脚本安装

在仓库根目录运行:

./scripts/install.sh

默认会执行以下操作:

  • 以 release 模式构建 slotd
  • slotd 安装到 ~/.local/bin
  • 创建 sbatchsqueue 等命令别名
  • ~/.local/share/slotd 下创建 runtime root
  • 写入 ~/.config/slotd/slotd.env
  • 安装并启动 systemd --user 服务

安装脚本选项

选项说明默认值
--repo-root PATH从其他仓库根目录构建当前仓库
--profile NAME使用的 Cargo profilerelease
--install-bin-dir PATH二进制和别名安装目录~/.local/bin
--runtime-root PATH作为 SLOTD_ROOT 的 runtime root~/.local/share/slotd
--config-dir PATH配置目录~/.config/slotd
--systemd-user-dir PATHuser unit 目录~/.config/systemd/user
--cpu-partitions VALUE写入 SLOTD_CPU_PARTITIONS 的值cpu
--gpu-partitions VALUE写入 SLOTD_GPU_PARTITIONS 的值gpu
--features VALUE写入 SLOTD_FEATURES 的值未设置
--notify-cmd VALUE写入 SLOTD_NOTIFY_CMD 的值未设置
--cgroup-base PATH写入 SLOTD_CGROUP_BASE 的值未设置
--skip-build复用已有构建产物off
--skip-systemd不安装或启动 user serviceoff
--uninstall删除已安装内容off
--purge-runtime卸载时删除持久化状态off

示例:

./scripts/install.sh \
 --features cpu,gpu \
  --notify-cmd 'notify-send "slotd" "$SLOTD_JOB_ID $SLOTD_JOB_STATE"'

如果使用 --cgroup-base,请传入一个可写的 cgroup v2 subtree。若保持未设置, CPU 与内存仍然只按预留值参与调度。

卸载

删除安装内容:

./scripts/install.sh --uninstall

删除安装内容和 runtime 状态:

./scripts/install.sh --uninstall --purge-runtime

手动安装

如果不想使用安装脚本,也可以直接构建并运行 slotd

cargo build --release
SLOTD_ROOT="$HOME/.local/share/slotd" ./target/release/slotd daemon

然后在另一个 shell 中使用相同的 SLOTD_ROOT

SLOTD_ROOT="$HOME/.local/share/slotd" ./target/release/slotd sbatch --wrap 'echo hello'

Runtime 文件

默认的 runtime root 为:

~/.local/share/slotd

重要文件和目录:

  • run/slotd.sock
  • lib/state.db
  • lib/jobs/<job_id>/

client 与 daemon 必须使用相同的 SLOTD_ROOT