diff --git a/pkg/scheduler/objects/application.go b/pkg/scheduler/objects/application.go index 088501e12..4b679b01e 100644 --- a/pkg/scheduler/objects/application.go +++ b/pkg/scheduler/objects/application.go @@ -54,11 +54,11 @@ const ( ) type PlaceholderData struct { - TaskGroupName string - RequiredNode string - AllocatedResource *resources.Resource - Count int64 - Replaced int64 + TaskGroupName string + Count int64 + MinResource *resources.Resource + RequiredNode string + Replaced int64 } type Application struct { @@ -1535,7 +1535,7 @@ func (sa *Application) GetRejectedMessage() string { return sa.rejectedMessage } -func (sa *Application) SetPlaceholderData(taskGroupName string, allocatedResource *resources.Resource, requiredNode string) { +func (sa *Application) SetPlaceholderData(taskGroupName string, minResource *resources.Resource, requiredNode string) { sa.Lock() defer sa.Unlock() if sa.PlaceholderDatas == nil { @@ -1543,9 +1543,9 @@ func (sa *Application) SetPlaceholderData(taskGroupName string, allocatedResourc } if _, ok := sa.PlaceholderDatas[taskGroupName]; !ok { sa.PlaceholderDatas[taskGroupName] = &PlaceholderData{ - TaskGroupName: taskGroupName, - RequiredNode: requiredNode, - AllocatedResource: allocatedResource, + TaskGroupName: taskGroupName, + MinResource: minResource, + RequiredNode: requiredNode, } } sa.PlaceholderDatas[taskGroupName].Count++ diff --git a/pkg/webservice/dao/application_info.go b/pkg/webservice/dao/application_info.go index 6e1c13da8..6dc122304 100644 --- a/pkg/webservice/dao/application_info.go +++ b/pkg/webservice/dao/application_info.go @@ -52,9 +52,9 @@ type AllocationDAOInfo struct { } type PlaceholderDAOInfo struct { - TaskGroupName string `json:"taskGroupName"` - RequiredNode string `json:"requiredNode"` - AllocatedResource *resources.Resource `json:"allocatedResource"` - Count int64 `json:"count"` - Replaced int64 `json:"replaced"` + TaskGroupName string `json:"taskGroupName"` + Count int64 `json:"count"` + MinResource *resources.Resource `json:"allocatedResource"` + RequiredNode string `json:"requiredNode"` + Replaced int64 `json:"replaced"` } diff --git a/pkg/webservice/handlers.go b/pkg/webservice/handlers.go index 04f20d11e..bc89d03cd 100644 --- a/pkg/webservice/handlers.go +++ b/pkg/webservice/handlers.go @@ -280,7 +280,6 @@ func getApplicationJSON(app *objects.Application) *dao.ApplicationDAOInfo { placeHolderInfos := make([]dao.PlaceholderDAOInfo, 0, len(app.PlaceholderDatas)) // Used to confirm whether the taskGroupName is duplicated taskGroupNames := map[string]bool{} - for _, alloc := range allocations { allocInfo := dao.AllocationDAOInfo{ AllocationKey: alloc.AllocationKey, @@ -294,17 +293,16 @@ func getApplicationJSON(app *objects.Application) *dao.ApplicationDAOInfo { Partition: alloc.PartitionName, } allocationInfos = append(allocationInfos, allocInfo) - if alloc.IsPlaceholder() { taskGroupName := alloc.GetTaskGroup() if _, ok := taskGroupNames[taskGroupName]; !ok { taskGroupNames[taskGroupName] = true placeHolderInfo := dao.PlaceholderDAOInfo{ - TaskGroupName: taskGroupName, - RequiredNode: app.PlaceholderDatas[taskGroupName].RequiredNode, - AllocatedResource: app.PlaceholderDatas[taskGroupName].AllocatedResource, - Count: app.PlaceholderDatas[taskGroupName].Count, - Replaced: app.PlaceholderDatas[taskGroupName].Replaced, + TaskGroupName: taskGroupName, + Count: app.PlaceholderDatas[taskGroupName].Count, + MinResource: app.PlaceholderDatas[taskGroupName].MinResource, + RequiredNode: app.PlaceholderDatas[taskGroupName].RequiredNode, + Replaced: app.PlaceholderDatas[taskGroupName].Replaced, } placeHolderInfos = append(placeHolderInfos, placeHolderInfo) }