|
|
|
@@ -149,8 +149,19 @@ func GetAllCloudbrainsTrend(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
} else if queryType == "current_week" { |
|
|
|
beginTime = now.AddDate(0, 0, -int(time.Now().Weekday())+1) //begin from monday |
|
|
|
} else if queryType == "last_7day" { |
|
|
|
beginTime = now.AddDate(0, 0, -7) //begin from monday |
|
|
|
beginTime = time.Date(beginTime.Year(), beginTime.Month(), beginTime.Day(), 0, 0, 0, 0, now.Location()) |
|
|
|
endTime = now |
|
|
|
endTimeTemp = beginTime.AddDate(0, 0, 1) |
|
|
|
dateCloudbrainNum, err = getDayCloudbrainNum(beginTime, endTimeTemp, endTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query getDayCloudbrainNum.", err) |
|
|
|
ctx.Error(http.StatusBadRequest, ctx.Tr("getDayCloudbrainNum_get_error")) |
|
|
|
return |
|
|
|
} |
|
|
|
} else if queryType == "last_30day" { |
|
|
|
beginTime = now.AddDate(0, 0, -30) //begin from monday |
|
|
|
beginTime = time.Date(beginTime.Year(), beginTime.Month(), beginTime.Day(), 0, 0, 0, 0, now.Location()) |
|
|
|
endTime = now |
|
|
|
endTimeTemp = beginTime.AddDate(0, 0, 1) |
|
|
|
@@ -376,6 +387,13 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { |
|
|
|
intelligentNetJobTypeRes[v] = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
cloudBrainTypeList := []int{0, 1, 2} |
|
|
|
for _, v := range cloudBrainTypeList { |
|
|
|
if _, ok := cloudBrainPeriodNum[v]; !ok { |
|
|
|
cloudBrainPeriodNum[v] = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
// totalTasksCount := cloudBrainPeriodNum[0] + cloudBrainPeriodNum[1] + cloudBrainPeriodNum[2] |
|
|
|
|
|
|
|
cloudOneJobTypeRes["EVALUATION"] = cloudOneJobTypeRes["BENCHMARK"] + cloudOneJobTypeRes["SNN4IMAGENET"] + cloudOneJobTypeRes["BRAINSCORE"] |
|
|
|
cloudTwoJobTypeRes["EVALUATION"] = cloudTwoJobTypeRes["BENCHMARK"] + cloudTwoJobTypeRes["SNN4IMAGENET"] + cloudTwoJobTypeRes["BRAINSCORE"] |
|
|
|
@@ -385,6 +403,7 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { |
|
|
|
"cloudTwoJobTypeRes": cloudTwoJobTypeRes, |
|
|
|
"intelligentNetJobTypeRes": intelligentNetJobTypeRes, |
|
|
|
"cloudBrainPeriodNum": cloudBrainPeriodNum, |
|
|
|
// "totalTasksCount": totalTasksCount, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@@ -463,13 +482,16 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
ctx.ServerError("Get job failed:", err) |
|
|
|
return |
|
|
|
} |
|
|
|
// var taskList := []*models.TaskDetail |
|
|
|
|
|
|
|
res := &models.AllTask{} |
|
|
|
res.List = []models.TaskDetail{} |
|
|
|
for i, task := range ciTasks { |
|
|
|
ciTasks[i].CanDebug = true |
|
|
|
ciTasks[i].CanDel = true |
|
|
|
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource |
|
|
|
|
|
|
|
var dataOne models.TaskDetail |
|
|
|
dataOne.DisplayJobName = ciTasks[i].DisplayJobName |
|
|
|
res.List = append(res.List, dataOne) |
|
|
|
} |
|
|
|
|
|
|
|
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) |
|
|
|
@@ -502,6 +524,9 @@ func GetCloudbrainsCreateHoursData(ctx *context.Context) { |
|
|
|
if queryType == "all" { |
|
|
|
beginTime = brainRecordBeginTime |
|
|
|
endTime = now |
|
|
|
} else if queryType == "today" { |
|
|
|
beginTime = now.AddDate(0, 0, 0) |
|
|
|
endTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) |
|
|
|
} else if queryType == "yesterday" { |
|
|
|
beginTime = now.AddDate(0, 0, -1) |
|
|
|
endTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) |
|
|
|
@@ -551,8 +576,16 @@ func GetCloudbrainsCreateHoursData(ctx *context.Context) { |
|
|
|
ctx.Error(http.StatusBadRequest, ctx.Tr("hourPeriodCount_get_error")) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
runHourPeriodCount, err := models.GetRunHourPeriodCount(dateBeginTime, dateEndTime) |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not query runHourPeriodCount.", err) |
|
|
|
ctx.Error(http.StatusBadRequest, ctx.Tr("runHourPeriodCount_get_error")) |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
"createHourPeriodCount": createHourPeriodCount, |
|
|
|
"runHourPeriodCount": runHourPeriodCount, |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
@@ -732,6 +765,7 @@ func getCloudbrainCount(beginTime time.Time, endTime time.Time) (map[string]int, |
|
|
|
cloudBrainPeriodNum[v] = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
cloudBrainPeriodNum[-1] = cloudBrainPeriodNum[0] + cloudBrainPeriodNum[1] + cloudBrainPeriodNum[2] |
|
|
|
return cloudOneJobTypeRes, cloudTwoJobTypeRes, intelligentNetJobTypeRes, cloudBrainPeriodNum, cloudBrainComputeResource, err |
|
|
|
} |
|
|
|
|
|
|
|
|