#5041 将补丁分支合入到主分支。

Merged
ychao_1983 merged 13 commits from V20231211_patch into V20240109 4 months ago
  1. +7
    -9
      models/user_business_analysis.go
  2. +1
    -1
      models/user_year_summary.go
  3. +1
    -1
      modules/base/tool.go
  4. +6
    -6
      routers/repo/user_data_analysis.go

+ 7
- 9
models/user_business_analysis.go View File

@@ -579,18 +579,19 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS
var CommitCodeSizeMap map[string]*git.UserKPIStats
var err error
var existCommitCodeSize map[int64]int
if tableName == "user_business_analysis_all" || tableName == "user_business_analysis_current_year" {

if tableName == "user_business_analysis_all" {
oneDayStartTime := pageEndTime.AddDate(0, 0, -1)
oneDayStartTime = time.Date(oneDayStartTime.Year(), oneDayStartTime.Month(), oneDayStartTime.Day(), 0, 0, 0, 1, oneDayStartTime.Location())
if oneDayStartTime.Format("2006-01-02") == pageStartTime.Format("2006-01-02") {
existCommitCodeSize = make(map[int64]int, 0)
} else {
existCommitCodeSize = queryCommitCodeSizeFromDb("public." + tableName)
}
oneDayEndTime := time.Date(oneDayStartTime.Year(), oneDayStartTime.Month(), oneDayStartTime.Day(), 23, 59, 59, 1, oneDayStartTime.Location())
log.Info("GetAllUserKPIStats oneDayStartTime=" + oneDayStartTime.Format("2006-01-02 15:04:05"))
log.Info("GetAllUserKPIStats pageEndTime=" + pageEndTime.Format("2006-01-02 15:04:05"))
log.Info("GetAllUserKPIStats pageEndTime=" + oneDayEndTime.Format("2006-01-02 15:04:05"))
log.Info("existCommitCodeSize len=" + fmt.Sprint(len(existCommitCodeSize)))
CommitCodeSizeMap, err = GetAllUserKPIStats(oneDayStartTime, pageEndTime)
CommitCodeSizeMap, err = GetAllUserKPIStats(oneDayStartTime, oneDayEndTime)
if err != nil {
log.Info("query commit code errr.")
} else {
@@ -2286,7 +2287,7 @@ func queryUserModelConvert(start_unix int64, end_unix int64) map[int64]int {
}

func isBenchMark(JobType string) bool {
if JobType == "BENCHMARK" || JobType == "MODELSAFETY" || JobType == "SNN4IMAGENET" || JobType == "BRAINSCORE" || JobType == "SNN4ECOSET" {
if JobType == "BENCHMARK" || JobType == "MODELSAFETY" || JobType == "SNN4IMAGENET" || JobType == "BRAINSCORE" || JobType == "SNN4ECOSET" || JobType == "SIM2BRAIN_SNN" {
return true
}
return false
@@ -2322,12 +2323,9 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s
if _, ok := resourceItemMap[cloudTaskRecord.UserID]; !ok {
resourceItemMap[cloudTaskRecord.UserID] = make(map[string]int)
}

if cloudTaskRecord.Duration < 100000000 && cloudTaskRecord.Duration > 0 {
setMapKey("CloudBrainRunTime", cloudTaskRecord.UserID, int(cloudTaskRecord.Duration), resultItemMap)
resourceItemMap[cloudTaskRecord.UserID][cloudTaskRecord.ComputeResource] = resourceItemMap[cloudTaskRecord.UserID][cloudTaskRecord.ComputeResource] + int(cloudTaskRecord.Duration)
} else {
resourceItemMap[cloudTaskRecord.UserID][cloudTaskRecord.ComputeResource] = 0
}
if cloudTaskRecord.Type == 1 { //npu
setMapKey("CloudBrainTwo", cloudTaskRecord.UserID, 1, resultItemMap)
@@ -2359,7 +2357,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s
} else {
setMapKey("NpuDebugJob", cloudTaskRecord.UserID, 1, resultItemMap)
}
} else if cloudTaskRecord.ComputeResource == GPUResource {
} else {
if cloudTaskRecord.JobType == "TRAIN" {
setMapKey("GpuTrainJob", cloudTaskRecord.UserID, 1, resultItemMap)
} else if cloudTaskRecord.JobType == "ONLINEINFERENCE" {


+ 1
- 1
models/user_year_summary.go View File

@@ -342,7 +342,7 @@ func queryUserYearModel(start_unix int64, end_unix int64) map[int64]map[string]i
var indexTotal int64
indexTotal = 0
for {
sess.Select("id,user_id,download_count,reference_count").Table("ai_model_manage").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal))
sess.Select("id,name,user_id,download_count,reference_count").Table("ai_model_manage").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal))
aiModelList := make([]*AiModelManage, 0)
sess.Find(&aiModelList)
log.Info("query user year AiModelManage size=" + fmt.Sprint(len(aiModelList)))


+ 1
- 1
modules/base/tool.go View File

@@ -224,7 +224,7 @@ func SizedAvatarLinkWithDomain(email string, size int) string {

// FileSize calculates the file size and generate user-friendly string.
func FileSize(s int64) string {
return humanize.Bytes(uint64(s))
return humanize.IBytes(uint64(s))
}

// PrettyNumber produces a string form of the given number in base 10 with


+ 6
- 6
routers/repo/user_data_analysis.go View File

@@ -724,12 +724,6 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) {
startYear := time.Date(USER_YEAR, 1, 1, 0, 0, 0, 1, t.Location())
endYear := startYear.AddDate(1, 0, 0)

if time.Now().Year() == 2024 {
log.Info("the day is 2024,so not update.")
return
}
models.RefreshUserYearTable(startYear, endYear)

//query wiki data
log.Info("start to time count data")
wikiMap, err := queryWikiCountMap(startTime, endTime)
@@ -740,6 +734,12 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) {
mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage)
}

if time.Now().Year() == 2024 {
log.Info("the day is 2024,so not update.")
return
}
models.RefreshUserYearTable(startYear, endYear)

log.Info("end to count all user info data")
}



Loading…
Cancel
Save