Skip to content

[POC] Schedule Slurm jobs with node-count runner labels / 使用节点数 Runner 标签调度 Slurm 任务 - #2440

Draft
cquil11 wants to merge 2 commits into
mainfrom
agent/node-slot-scheduling-poc
Draft

[POC] Schedule Slurm jobs with node-count runner labels / 使用节点数 Runner 标签调度 Slurm 任务#2440
cquil11 wants to merge 2 commits into
mainfrom
agent/node-slot-scheduling-poc

Conversation

@cquil11

@cquil11 cquil11 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

This draft proof of concept uses static GitHub runner labels as Slurm allocation-size admission slots.

  • Generates node-count for every multi-node matrix row from checked-in recipe resources, explicit PREFILL_NODES/DECODE_NODES, or the worker GPU topology.
  • Adds nodes:N to runs-on when NODE_SLOT_SCHEDULER_ENABLED=true; single-node jobs request nodes:1.
  • Adds a planner that assigns nodes:N to the first floor(pool_size / N) runners in configured order. For 12 runners, nodes:1, nodes:2, and nodes:3 have 12, 6, and 4 eligible slots.
  • Uses node count as a secondary priority tie-breaker, so otherwise-equal smaller allocations run first.
  • Keeps the feature disabled by default so the workflow can merge before live runner labels are applied.

Important behavior

GitHub still selects one launcher runner; Slurm allocates the requested compute nodes. Because runs-on arrays use AND semantics, the launcher must have the hardware, static nodes:N, and dynamic queue labels.

This caps uniform allocation sizes correctly but is not exact weighted accounting for mixed sizes. For example, simultaneous one-node and three-node jobs can collectively request more than the physical pool. Slurm remains the final capacity authority. Recipes that exist only in a runtime image currently fall back to a topology estimate and should be audited before enabling the feature.

Activation

  1. Run python utils/runner_setup/plan_node_labels.py <cluster-label>.
  2. Apply the emitted labels to the live runners.
  3. Set NODE_SLOT_SCHEDULER_ENABLED=true.

Validation

  • python -m pytest utils/matrix_logic/ utils/test_ci_priority.py -q — 246 passed.
  • Generated all NVIDIA and AMD master-config rows; every multi-node row has node-count.
  • Compared 216 generated rows across 185 checked-in srt-slurm recipes with authoritative resource totals; zero mismatches.
  • actionlint found no new workflow-call or node-slot expression errors; existing unrelated shell/style warnings remain.

中文说明

此 Draft PR 是一个概念验证,使用静态 GitHub runner 标签作为不同 Slurm 节点规模任务的准入槽位。

  • 为每个多节点矩阵任务生成 node-count。节点数依次取自仓库内的 recipe 资源配置、显式 PREFILL_NODES/DECODE_NODES,或 worker GPU 拓扑。
  • NODE_SLOT_SCHEDULER_ENABLED=true 时,在 runs-on 中加入 nodes:N;单节点任务使用 nodes:1
  • 新增标签规划工具,按配置中的 runner 顺序,将 nodes:N 分配给前 floor(pool_size / N) 个 runner。例如 12 个 runner 时,nodes:1nodes:2nodes:3 分别有 12、6 和 4 个可用槽位。
  • 将节点数作为 CI 优先级的次级排序条件;其他优先级条件相同时,小规模任务优先。
  • 默认不启用该功能,允许先合并工作流代码,再配置线上 runner 标签。

重要行为

GitHub 仍然只选择一个启动器 runner,实际计算节点由 Slurm 分配。由于 runs-on 数组采用 AND 语义,启动器必须同时具备硬件标签、静态 nodes:N 标签和动态队列标签。

该方案能正确限制同一节点规模任务的并发数,但不能对混合规模任务进行精确的加权资源核算。例如,单节点和三节点任务同时运行时,总请求量仍可能超过物理节点池,最终容量控制仍由 Slurm 负责。仅存在于运行时镜像中的 recipe 目前会使用拓扑估算值;正式启用前需要审计这些配置。

启用步骤

  1. 运行 python utils/runner_setup/plan_node_labels.py <cluster-label>
  2. 将输出的标签应用到线上 runner。
  3. 设置 NODE_SLOT_SCHEDULER_ENABLED=true

验证

  • python -m pytest utils/matrix_logic/ utils/test_ci_priority.py -q:246 项测试全部通过。
  • 成功生成 NVIDIA 和 AMD 全部主配置任务;每个多节点任务都包含 node-count
  • 将 185 个仓库内 srt-slurm recipe 对应的 216 个生成任务与权威资源配置进行比较,未发现不一致。
  • actionlint 未发现新的 workflow 调用或节点槽位表达式错误;仅保留已有且与本 PR 无关的 shell/style 警告。

Derive Slurm node requirements for generated multi-node jobs, gate nodes:N labels behind a repository variable, and add a deterministic static-label planner for runner pools. Use node count as a secondary priority tie-breaker.

中文:为生成的多节点任务推导 Slurm 节点需求,通过仓库变量控制 nodes:N 标签,并为 runner 池新增确定性的静态标签规划工具。同时将节点数作为 CI 优先级的次级排序条件。
The small static-label planning utility is sufficiently transparent for this proof of concept and does not need a dedicated test file.

中文:静态标签规划工具逻辑简单直观,本概念验证无需为其保留独立测试文件。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant