Skip to content

feat: improve prequeue admission and quota controls#399

Open
YiD11 wants to merge 1 commit intoraids-lab:mainfrom
YiD11:feat/backfill0422
Open

feat: improve prequeue admission and quota controls#399
YiD11 wants to merge 1 commit intoraids-lab:mainfrom
YiD11:feat/backfill0422

Conversation

@YiD11
Copy link
Copy Markdown
Contributor

@YiD11 YiD11 commented Apr 29, 2026

Add job admission checks before Volcano submission and refine prequeue routing for quota pressure and timed-out pending normal jobs. Centralize prequeue runtime config, make candidate size a global setting, simplify queue quota records to named resource limits, and move public queue limit management into account settings.

Add job admission checks before Volcano submission and refine prequeue routing for quota pressure and timed-out pending normal jobs. Centralize prequeue runtime config, make candidate size a global setting, simplify queue quota records to named resource limits, and move public queue limit management into account settings.
Copilot AI review requested due to automatic review settings April 29, 2026 08:47
@YiD11 YiD11 added frontend website and web frontend backend web backend or deployments labels Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在增强作业提交前的可调度性校验(避免明显无法落盘/调度的 Volcano Job),并重构 prequeue + 队列配额(queue quota)相关的配置与前端管理入口:将候选作业数(candidate size)收敛为全局配置,同时把公共队列(default)的队内上限配置移动到账号设置中展示与维护。

Changes:

  • 后端:新增 Volcano Job admission 检查;prequeue 激活候选集大小改为全局配置;简化 queue quota 记录结构并同步迁移/接口/Swagger。
  • 前端:平台设置页移除原“用户资源限制(queue quota)”管理,改为在账户页展示/维护 default 队列队内上限;新增 prequeueCandidateSize 配置项;表格支持全局搜索并在筛选/排序时重置分页。
  • 文案:将 backfill 文案调整为 “Elastic/弹性” 等多语言更新。

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/utils/quota.ts 表单 schema 增加 queueLimit 字段,并提供表单与队列配额的互转工具函数。
frontend/src/services/api/system-config.ts IPrequeueConfig 增加 prequeueCandidateSize 字段。
frontend/src/services/api/queue-quota.ts 精简 IQueueQuota(移除 enabled、prequeueCandidateSize 等字段)。
frontend/src/routes/admin/more/index.tsx 平台设置页移除 UserResourceLimit 管理区块,新增 prequeueCandidateSize 配置绑定。
frontend/src/routes/admin/more/-components/user-resource-limit.tsx 删除旧的“用户资源限制”管理组件实现。
frontend/src/routes/admin/more/-components/prequeue-settings.tsx Prequeue 设置 UI 增加候选作业数输入框。
frontend/src/routes/admin/accounts/-components/account-table.tsx 账户列表新增“队内上限”列(展示 default 队列 quota)。
frontend/src/routes/admin/accounts/-components/account-form-component.tsx 在 default 账户编辑中读写 queue quota,并在资源表单中新增 queueLimit 输入。
frontend/src/i18n/locales/zhCN/translation.json 增加 queueLimit / candidateSize 等文案;backfill 文案调整为“弹性”。
frontend/src/i18n/locales/ko/translation.json 同步新增/调整相关文案(韩语)。
frontend/src/i18n/locales/ja/translation.json 同步新增/调整相关文案(日语)。
frontend/src/i18n/locales/enUS/translation.json 同步新增/调整相关文案(英语)。
frontend/src/components/query-table/index.tsx DataTable 增加 globalFilter 状态与 onChange 处理,并在筛选/排序/搜索时重置分页。
backend/pkg/vcjob/admission/admission.go 新增作业 admission 检查:基于节点 allocatable + 调度约束做放置可行性评估。
backend/pkg/utils/resource.go 增加资源计算/拷贝/覆盖判断/缺口/摘要等通用工具方法。
backend/pkg/reconciler/vcjob-reconciler.go 释放态判断统一用 isReleasedJobPhase 触发事件/终止态采集。
backend/pkg/prequeuewatcher/watcher.go ticker duration 计算方式调整为显式 time.Duration * time.Second。
backend/pkg/prequeuewatcher/scheduling.go 移除本地调度约束判断实现(后续复用 admission 包)。
backend/pkg/prequeuewatcher/runtime_config.go runtime config 类型迁移到 dao/model,并移除 seconds() 辅助函数。
backend/pkg/prequeuewatcher/resources.go 资源覆盖/缺口计算复用 utils(删除重复实现)。
backend/pkg/prequeuewatcher/preemption.go 调度约束与资源缺口逻辑复用 vcjob/admission 与 utils。
backend/pkg/prequeuewatcher/activation.go 激活候选选择改为受全局 prequeueCandidateSize 限制。
backend/internal/service/vcjob/runtime.go 计算 Job 总资源改为复用 utils.CalculateReplicatedResources。
backend/internal/service/prequeue_service.go queue quota 配置结构简化;新增 CheckRequestedResourceLimit;ResolveQueueQuota 启用逻辑调整。
backend/internal/service/config_service.go PrequeueConfig 读取返回 model.PrequeueRuntimeConfig;UpdatePrequeueConfig 改为“可选字段更新”的请求结构。
backend/internal/handler/vcjob/tensorflow.go 资源聚合改为复用 utils.CalculateReplicatedResources。
backend/internal/handler/vcjob/pytorch.go 资源聚合改为复用 utils.CalculateReplicatedResources。
backend/internal/handler/vcjob/lifecycle.go 提交路径增加 admission 检查与更细化的 quota 检查/路由逻辑。
backend/internal/handler/system_config.go PrequeueConfig API 增加 prequeueCandidateSize 字段并支持更新。
backend/internal/handler/queue_quota.go queue quota API request/response 精简字段(仅 name + quota)。
backend/docs/swagger.yaml Swagger 定义同步更新(prequeueCandidateSize、queue quota 字段变化)。
backend/docs/swagger.json Swagger JSON 同步更新。
backend/docs/docs.go swagger docs.go 同步更新。
backend/dao/query/queue_quotas.gen.go gorm-gen 查询字段同步删除 enabled / prequeue_candidate_size。
backend/dao/model/queue_quota.go QueueQuotaLimit 模型移除 enabled / prequeue_candidate_size 字段。
backend/dao/model/prequeue_config.go 新增 PrequeueCandidateSizeKey 与 PrequeueRuntimeConfig(含校验/默认值)。
backend/cmd/gorm-gen/models/migrate.go 数据库迁移:删除 queue_quotas 表的 enabled / prequeue_candidate_size 列(含回滚)。

Comment on lines 56 to 70
const getHeader = (key: string): string => {
switch (key) {
case 'nickname':
return 'table.headers.nickname'
case 'deserved':
return 'table.headers.deserved'
case 'guaranteed':
return 'table.headers.guaranteed'
case 'capability':
return 'table.headers.capability'
case 'queueLimit':
return 'table.headers.queueLimit'
default:
return key
}
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【核心规范】【bug】getHeader() 这里返回的是 i18n key(如 table.headers.queueLimit),但 DataTableViewOptions 里不会再调用 t() 翻译(直接渲染 getHeader 的返回值),因此“列显示/隐藏”下拉里会展示原始 key。建议让 getHeader 返回最终展示文本(在组件内用 t() 生成),或统一在 DataTableViewOptions 内部对返回值做翻译(并保证其它调用方不重复翻译)。另外该问题在该函数其它 case 也同样存在,请一并修复。

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
cfg, err := w.configService.GetPrequeueConfig(ctx)
if err != nil {
return true, err
}
prequeueCandidateSize := cfg.PrequeueCandidateSize
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

【优化建议】【performance】activateNextPrequeueBatch() 内部每次都会调用 configService.GetPrequeueConfig() 读库获取 PrequeueCandidateSize,但 watcher 主循环每轮已经 refreshRuntimeConfig 并缓存到 runtimeConfig(currentRuntimeConfig)。这里再读库会增加 DB 压力,且可能在需要快速循环扫描时形成热点。建议直接使用 w.currentRuntimeConfig().PrequeueCandidateSize(或把该值作为参数传入),避免重复查询。

Suggested change
cfg, err := w.configService.GetPrequeueConfig(ctx)
if err != nil {
return true, err
}
prequeueCandidateSize := cfg.PrequeueCandidateSize
runtimeCfg := w.currentRuntimeConfig()
prequeueCandidateSize := runtimeCfg.PrequeueCandidateSize

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend web backend or deployments frontend website and web frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants