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:
@@ -369,6 +369,18 @@ func (s *TaskService) ProcessTask(ctx context.Context, taskID int64) error {
|
||||
}
|
||||
}
|
||||
|
||||
// 16b-3. Auto-inject scheduling params based on scheduling_map.
|
||||
// If an Application parameter declares scheduling_map, the corresponding
|
||||
// scheduling field value overrides any user-provided value.
|
||||
for _, p := range params {
|
||||
if p.SchedulingMap == "" {
|
||||
continue
|
||||
}
|
||||
if val := ResolveSchedulingMap(p.SchedulingMap, task); val != "" {
|
||||
values[p.Name] = val
|
||||
}
|
||||
}
|
||||
|
||||
// 16c. Validate all params (WORK_DIR and file params now have values).
|
||||
if err := ValidateParams(params, values); err != nil {
|
||||
return fail(model.TaskStepSubmitting, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user