|
|
|
@@ -70,7 +70,11 @@ func summaryDurationStat(statisticTime time.Time) int64 { |
|
|
|
} |
|
|
|
cardsTotalDurationMap := make(map[string]int) |
|
|
|
for _, resourceQueue := range resourceQueues { |
|
|
|
cardsTotalDurationMap[resourceQueue.Cluster+"/"+resourceQueue.AiCenterCode+"/"+resourceQueue.AccCardType+"/"+resourceQueue.ComputeResource] = resourceQueue.CardsTotalNum * 1 * 60 * 60 |
|
|
|
if _, ok := cardsTotalDurationMap[resourceQueue.Cluster+"/"+resourceQueue.AiCenterCode+"/"+resourceQueue.AccCardType+"/"+resourceQueue.ComputeResource]; !ok { |
|
|
|
cardsTotalDurationMap[resourceQueue.Cluster+"/"+resourceQueue.AiCenterCode+"/"+resourceQueue.AccCardType+"/"+resourceQueue.ComputeResource] = resourceQueue.CardsTotalNum * 1 * 60 * 60 |
|
|
|
} else { |
|
|
|
cardsTotalDurationMap[resourceQueue.Cluster+"/"+resourceQueue.AiCenterCode+"/"+resourceQueue.AccCardType+"/"+resourceQueue.ComputeResource] += resourceQueue.CardsTotalNum * 1 * 60 * 60 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for centerCode, CardTypes := range cloudBrainCenterCodeAndCardTypeInfo { |
|
|
|
@@ -224,9 +228,11 @@ func getcloudBrainCenterCodeAndCardTypeInfo(ciTasks []*models.CloudbrainInfo, be |
|
|
|
} |
|
|
|
|
|
|
|
func CloudbrainUpdateHistoryData(ctx *context.Context) { |
|
|
|
err := models.DeleteCloudbrainDurationStatistic() |
|
|
|
count := UpdateDurationStatisticHistoryData() |
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
"message": 0, |
|
|
|
"count": count, |
|
|
|
"err": err, |
|
|
|
}) |
|
|
|
} |