feat(task): auto-inject scheduling params into script template via scheduling_map

Add scheduling_map field to ParameterSchema so Application creators can
declare that a parameter (e.g. NP) maps to a scheduling field (e.g. cpus).
The backend auto-injects the scheduling value into script template variables
before rendering, eliminating duplicate user input. The frontend hides
mapped parameters from the form and injects their values on submit.
This commit is contained in:
dailz
2026-04-22 10:26:52 +08:00
parent 435ab285c1
commit 5591b67f75
9 changed files with 206 additions and 2 deletions

View File

@@ -123,3 +123,28 @@ func RandomSuffix(n int) string {
}
return string(b)
}
func ResolveSchedulingMap(field string, task *model.Task) string {
switch field {
case "cpus":
return derefInt32ToStr(task.Cpus)
case "memory_per_node":
return derefInt64ToStr(task.MemoryPerNode)
case "memory_per_cpu":
return derefInt64ToStr(task.MemoryPerCpu)
case "nodes":
return derefStr(task.Nodes)
case "tasks":
return derefInt32ToStr(task.Tasks)
case "cpus_per_task":
return derefInt32ToStr(task.CpusPerTask)
case "partition":
return task.Partition
case "time_limit":
return derefInt32ToStr(task.TimeLimit)
case "qos":
return derefStr(task.QOS)
default:
return ""
}
}