|
|
@@ -887,12 +887,19 @@ func getBonusWeekDataMap() map[int64][]int { |
|
|
|
if err == nil { |
|
|
|
filenames := strings.Split(content, "\n") |
|
|
|
for i := 0; i < len(filenames); i++ { |
|
|
|
if strings.HasSuffix(filenames[i], "\r") { |
|
|
|
filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] |
|
|
|
} |
|
|
|
url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i] |
|
|
|
csvContent, err1 := GetContentFromPromote(url) |
|
|
|
if err1 == nil { |
|
|
|
//read csv |
|
|
|
lines := strings.Split(csvContent, "\n") |
|
|
|
for j := 1; j < len(lines); j++ { |
|
|
|
if strings.HasSuffix(lines[j], "\r") { |
|
|
|
lines[j] = lines[j][0 : len(lines[j])-len("\r")] |
|
|
|
} |
|
|
|
log.Info("aLine=" + lines[j]) |
|
|
|
aLine := strings.Split(lines[j], ",") |
|
|
|
if len(aLine) < 4 { |
|
|
|
continue |
|
|
@@ -901,6 +908,7 @@ func getBonusWeekDataMap() map[int64][]int { |
|
|
|
order := getIntValue(aLine[2]) |
|
|
|
money := getIntValue(aLine[3]) |
|
|
|
week, num := getWeekAndNum(filenames[i]) |
|
|
|
//log.Info("userId=" + fmt.Sprint(userId) + " order=" + fmt.Sprint(order) + " money=" + fmt.Sprint(money) + " week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) |
|
|
|
//email := lines[2] |
|
|
|
record, ok := bonusMap[userId] |
|
|
|
if !ok { |
|
|
@@ -949,12 +957,18 @@ func getBonusMap() map[string]map[string]int { |
|
|
|
if err == nil { |
|
|
|
filenames := strings.Split(content, "\n") |
|
|
|
for i := 0; i < len(filenames); i++ { |
|
|
|
if strings.HasSuffix(filenames[i], "\r") { |
|
|
|
filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] |
|
|
|
} |
|
|
|
url = setting.RecommentRepoAddr + "bonus/" + filenames[i] |
|
|
|
csvContent, err1 := GetContentFromPromote(url) |
|
|
|
if err1 == nil { |
|
|
|
//read csv |
|
|
|
lines := strings.Split(csvContent, "\n") |
|
|
|
for j := 1; j < len(lines); j++ { |
|
|
|
if strings.HasSuffix(lines[j], "\r") { |
|
|
|
lines[j] = lines[j][0 : len(lines[j])-len("\r")] |
|
|
|
} |
|
|
|
aLine := strings.Split(lines[j], ",") |
|
|
|
if len(aLine) < 7 { |
|
|
|
continue |
|
|
@@ -1030,18 +1044,14 @@ func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItem |
|
|
|
} |
|
|
|
cloudBrainInfo["inference_task_num"] = fmt.Sprint(dateRecordAll.NpuInferenceJob + CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_GpuInferenceJob"]) |
|
|
|
cloudBrainInfo["card_runtime"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime) |
|
|
|
if dateRecordAll.CloudBrainRunTime >= 100 { |
|
|
|
runtime = float64(dateRecordAll.CloudBrainRunTime) / float64(100) |
|
|
|
} |
|
|
|
cloudBrainInfo["card_runtime_money"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime * 5) |
|
|
|
cloudBrainInfo["CloudBrainOne"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainOne"]) |
|
|
|
cloudBrainInfo["CloudBrainTwo"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainTwo"]) |
|
|
|
cloudBrainInfo["C2Net"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_C2Net"]) |
|
|
|
|
|
|
|
cloudBrainInfoJson, _ := json.Marshal(cloudBrainInfo) |
|
|
|
scoreMap["trainscore"] = trainscore |
|
|
|
scoreMap["debugscore"] = debugscore |
|
|
|
scoreMap["runtime"] = runtime |
|
|
|
|
|
|
|
return string(cloudBrainInfoJson) |
|
|
|
} else { |
|
|
|
scoreMap["trainscore"] = trainscore |
|
|
@@ -2486,7 +2496,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s |
|
|
|
var indexTotal int64 |
|
|
|
indexTotal = 0 |
|
|
|
for { |
|
|
|
sess.Select("id,job_type,user_id,duration,train_job_duration,type").Table("cloudbrain").Unscoped().Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) |
|
|
|
sess.Select("id,job_type,user_id,duration,train_job_duration,type,compute_resource").Table("cloudbrain").Unscoped().Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) |
|
|
|
cloudTaskList := make([]*Cloudbrain, 0) |
|
|
|
sess.Find(&cloudTaskList) |
|
|
|
log.Info("query cloudbrain size=" + fmt.Sprint(len(cloudTaskList))) |
|
|
@@ -2519,7 +2529,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s |
|
|
|
} else { |
|
|
|
setMapKey("GpuDebugJob", cloudTaskRecord.UserID, 1, resultItemMap) |
|
|
|
} |
|
|
|
} else if cloudTaskRecord.Type == 2 { |
|
|
|
} else if cloudTaskRecord.Type == 2 || cloudTaskRecord.Type == 3 { |
|
|
|
setMapKey("C2Net", cloudTaskRecord.UserID, 1, resultItemMap) |
|
|
|
if cloudTaskRecord.ComputeResource == NPUResource { |
|
|
|
if cloudTaskRecord.JobType == "TRAIN" { |
|
|
|