fix runtask api types

This commit is contained in:
tzwang 2025-02-26 17:37:32 +08:00
parent db9d21bfa1
commit 0abdf06f2f
2 changed files with 88 additions and 81 deletions

View File

@ -238,7 +238,7 @@ type (
// 启动任务(资源已就绪):/runTask
RunTaskReq {
TaskID int64 `json:"taskID"`
ScheduledDatas []*DataScheduleResults `json:"scheduledDatas"`
ScheduledDatas []*DataScheduleResults `json:"scheduledDatas,optional"`
}
DataScheduleResults {

View File

@ -126,6 +126,12 @@ func (l *ScheduleRunTaskLogic) SaveResult(task *models.Task, results []*schedule
func updateClustersByScheduledDatas(taskId int64, clustersWithDataDistributes *ClustersWithDataDistributes, scheduledDatas []*types.DataScheduleResults) ([]*strategy.AssignedCluster, error) {
assignedClusters := make([]*strategy.AssignedCluster, 0)
if len(scheduledDatas) == 0 {
for _, cluster := range clustersWithDataDistributes.Clusters {
assignedClusters = append(assignedClusters, cluster)
}
} else {
// handle pass-in scheduledDatas
for _, cluster := range clustersWithDataDistributes.Clusters {
for _, data := range scheduledDatas {
@ -222,6 +228,7 @@ func updateClustersByScheduledDatas(taskId int64, clustersWithDataDistributes *C
}
assignedClusters = append(assignedClusters, cluster)
}
}
// handle db yaml clustersWithDataDistributes
for _, cluster := range assignedClusters {