|
|
|
@@ -571,20 +571,34 @@ func GetCloudbrainsStatusAnalysis(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
cloudBrainStatusResult := make(map[string]int) |
|
|
|
for _, cloudbrain := range cloudbrains { |
|
|
|
cloudBrainStatusAnalysis := make(map[string]int) |
|
|
|
totalCount := 0 |
|
|
|
for count, cloudbrain := range cloudbrains { |
|
|
|
if _, ok := cloudBrainStatusResult[cloudbrain.Status]; !ok { |
|
|
|
cloudBrainStatusResult[cloudbrain.Status] = 1 |
|
|
|
} else { |
|
|
|
cloudBrainStatusResult[cloudbrain.Status] += 1 |
|
|
|
} |
|
|
|
totalCount = count + 1 |
|
|
|
} |
|
|
|
log.Info("totalcount:", totalCount) |
|
|
|
var jobStatuses []string |
|
|
|
jobStatuses = append(jobStatuses, string(models.ModelArtsTrainJobWaiting), string(models.ModelArtsTrainJobFailed), string(models.ModelArtsRunning), string(models.ModelArtsTrainJobCompleted), |
|
|
|
string(models.ModelArtsStarting), string(models.ModelArtsRestarting), string(models.ModelArtsStartFailed), |
|
|
|
string(models.ModelArtsStopping), string(models.ModelArtsStopped), string(models.JobSucceeded)) |
|
|
|
jobStatusesCount := 0 |
|
|
|
for _, v := range jobStatuses { |
|
|
|
if _, ok := cloudBrainStatusResult[v]; !ok { |
|
|
|
cloudBrainStatusAnalysis[v] = 0 |
|
|
|
} else { |
|
|
|
cloudBrainStatusAnalysis[v] = cloudBrainStatusResult[v] |
|
|
|
} |
|
|
|
jobStatusesCount = jobStatusesCount + cloudBrainStatusResult[v] |
|
|
|
} |
|
|
|
cloudBrainStatusAnalysis["OTHER"] = totalCount - jobStatusesCount |
|
|
|
|
|
|
|
ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
"cloudBrainStatusResult": cloudBrainStatusResult, |
|
|
|
"cloudBrainStatusResult": cloudBrainStatusAnalysis, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@@ -603,14 +617,6 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
if pageSize <= 0 { |
|
|
|
pageSize = 10 |
|
|
|
} |
|
|
|
|
|
|
|
// var jobTypes []string |
|
|
|
// jobTypeNot := false |
|
|
|
// if jobType == string(models.JobTypeDebug) { |
|
|
|
// jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) |
|
|
|
// } else if jobType != "all" && jobType != "" { |
|
|
|
// jobTypes = append(jobTypes, jobType) |
|
|
|
// } |
|
|
|
var jobTypes []string |
|
|
|
jobTypeNot := false |
|
|
|
if jobType == string(models.JobTypeBenchmark) { |
|
|
|
@@ -671,6 +677,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
taskDetail.RepoID = ciTasks[i].RepoID |
|
|
|
if ciTasks[i].Repo != nil { |
|
|
|
taskDetail.RepoName = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Name |
|
|
|
taskDetail.RepoAlias = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Alias |
|
|
|
} |
|
|
|
if ciTasks[i].Cloudbrain.Status == string(models.JobWaiting) { |
|
|
|
WaitTimeInt := time.Now().Unix() - ciTasks[i].Cloudbrain.CreatedUnix.AsTime().Unix() |
|
|
|
|