|
|
|
@@ -421,6 +421,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS |
|
|
|
log.Info("query user error. return.") |
|
|
|
return |
|
|
|
} |
|
|
|
ParaWeight := getParaWeight() |
|
|
|
var indexTotal int64 |
|
|
|
indexTotal = 0 |
|
|
|
insertCount := 0 |
|
|
|
@@ -469,7 +470,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS |
|
|
|
dateRecordAll.NpuInferenceJob = getMapKeyStringValue(fmt.Sprint(dateRecordAll.ID)+"_NpuInferenceJob", CloudBrainTaskItemMap) |
|
|
|
dateRecordAll.GpuBenchMarkJob = getMapKeyStringValue(fmt.Sprint(dateRecordAll.ID)+"_GpuBenchMarkJob", CloudBrainTaskItemMap) |
|
|
|
dateRecordAll.CommitModelCount = getMapValue(dateRecordAll.ID, AiModelManageMap) |
|
|
|
//dateRecordAll.UserIndex = getUserIndex(dateRecordAll) |
|
|
|
dateRecordAll.UserIndex = getUserIndexFromAnalysisAll(dateRecordAll, ParaWeight) |
|
|
|
|
|
|
|
dateRecordBatch = append(dateRecordBatch, dateRecordAll) |
|
|
|
if len(dateRecordBatch) >= BATCH_INSERT_SIZE { |
|
|
|
@@ -601,6 +602,9 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, |
|
|
|
log.Info("query user error. return.") |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
ParaWeight := getParaWeight() |
|
|
|
|
|
|
|
var indexTotal int64 |
|
|
|
indexTotal = 0 |
|
|
|
for { |
|
|
|
@@ -661,7 +665,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, |
|
|
|
dateRecord.GpuBenchMarkJob = getMapKeyStringValue(fmt.Sprint(dateRecord.ID)+"_GpuBenchMarkJob", CloudBrainTaskItemMap) |
|
|
|
|
|
|
|
dateRecord.CommitModelCount = getMapValue(dateRecord.ID, AiModelManageMap) |
|
|
|
dateRecord.UserIndex = getUserIndex(dateRecord) |
|
|
|
dateRecord.UserIndex = getUserIndex(dateRecord, ParaWeight) |
|
|
|
|
|
|
|
_, err = statictisSess.Insert(&dateRecord) |
|
|
|
if err != nil { |
|
|
|
@@ -681,9 +685,83 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
func getUserIndex(dateRecord UserBusinessAnalysis) float64 { |
|
|
|
func getParaWeight() map[string]float64 { |
|
|
|
result := make(map[string]float64) |
|
|
|
statictisSess := xStatistic.NewSession() |
|
|
|
defer statictisSess.Close() |
|
|
|
statictisSess.Select("*").Table(new(UserAnalysisPara)) |
|
|
|
paraList := make([]*UserAnalysisPara, 0) |
|
|
|
statictisSess.Find(¶List) |
|
|
|
for _, paraRecord := range paraList { |
|
|
|
result[paraRecord.Key] = paraRecord.Value |
|
|
|
} |
|
|
|
return result |
|
|
|
} |
|
|
|
|
|
|
|
func getUserIndexFromAnalysisAll(dateRecord UserBusinessAnalysisAll, ParaWeight map[string]float64) float64 { |
|
|
|
var result float64 |
|
|
|
// PR数 0.20 |
|
|
|
// commit数 0.20 |
|
|
|
// 提出任务数 0.20 |
|
|
|
// 评论数 0.20 |
|
|
|
// 关注项目数 0.10 |
|
|
|
// 点赞项目数 0.10 |
|
|
|
// 登录次数 0.10 |
|
|
|
result = float64(dateRecord.CodeMergeCount) * getParaWeightValue("CodeMergeCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.CommitCount) * getParaWeightValue("CommitCount", ParaWeight, 0.2) |
|
|
|
log.Info("1 result=" + fmt.Sprint(result)) |
|
|
|
result += float64(dateRecord.IssueCount) * getParaWeightValue("IssueCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.CommentCount) * getParaWeightValue("CommentCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.FocusRepoCount) * getParaWeightValue("FocusRepoCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.StarRepoCount) * getParaWeightValue("StarRepoCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.LoginCount) * getParaWeightValue("LoginCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.WatchedCount) * getParaWeightValue("WatchedCount", ParaWeight, 0.3) |
|
|
|
result += float64(dateRecord.CommitCodeSize) * getParaWeightValue("CommitCodeSize", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.SolveIssueCount) * getParaWeightValue("SolveIssueCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.EncyclopediasCount) * getParaWeightValue("EncyclopediasCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.CreateRepoCount) * getParaWeightValue("CreateRepoCount", ParaWeight, 0.05) |
|
|
|
result += float64(dateRecord.CloudBrainTaskNum) * getParaWeightValue("CloudBrainTaskNum", ParaWeight, 0.3) |
|
|
|
result += float64(dateRecord.CommitModelCount) * getParaWeightValue("CommitModelCount", ParaWeight, 0.2) |
|
|
|
result += dateRecord.OpenIIndex * getParaWeightValue("OpenIIndex", ParaWeight, 0.1) |
|
|
|
|
|
|
|
return result |
|
|
|
} |
|
|
|
|
|
|
|
func getUserIndex(dateRecord UserBusinessAnalysis, ParaWeight map[string]float64) float64 { |
|
|
|
var result float64 |
|
|
|
// PR数 0.20 |
|
|
|
// commit数 0.20 |
|
|
|
// 提出任务数 0.20 |
|
|
|
// 评论数 0.20 |
|
|
|
// 关注项目数 0.10 |
|
|
|
// 点赞项目数 0.10 |
|
|
|
// 登录次数 0.10 |
|
|
|
result = float64(dateRecord.CodeMergeCount) * getParaWeightValue("CodeMergeCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.CommitCount) * getParaWeightValue("CommitCount", ParaWeight, 0.2) |
|
|
|
log.Info("2 result=" + fmt.Sprint(result)) |
|
|
|
result += float64(dateRecord.IssueCount) * getParaWeightValue("IssueCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.CommentCount) * getParaWeightValue("CommentCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.FocusRepoCount) * getParaWeightValue("FocusRepoCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.StarRepoCount) * getParaWeightValue("StarRepoCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.LoginCount) * getParaWeightValue("LoginCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.WatchedCount) * getParaWeightValue("WatchedCount", ParaWeight, 0.3) |
|
|
|
result += float64(dateRecord.CommitCodeSize) * getParaWeightValue("CommitCodeSize", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.SolveIssueCount) * getParaWeightValue("SolveIssueCount", ParaWeight, 0.2) |
|
|
|
result += float64(dateRecord.EncyclopediasCount) * getParaWeightValue("EncyclopediasCount", ParaWeight, 0.1) |
|
|
|
result += float64(dateRecord.CreateRepoCount) * getParaWeightValue("CreateRepoCount", ParaWeight, 0.05) |
|
|
|
result += float64(dateRecord.CloudBrainTaskNum) * getParaWeightValue("CloudBrainTaskNum", ParaWeight, 0.3) |
|
|
|
result += float64(dateRecord.CommitModelCount) * getParaWeightValue("CommitModelCount", ParaWeight, 0.2) |
|
|
|
result += dateRecord.OpenIIndex * getParaWeightValue("OpenIIndex", ParaWeight, 0.1) |
|
|
|
|
|
|
|
return result |
|
|
|
} |
|
|
|
|
|
|
|
return 0 |
|
|
|
func getParaWeightValue(key string, valueMap map[string]float64, defaultValue float64) float64 { |
|
|
|
if _, ok := valueMap[key]; !ok { |
|
|
|
return defaultValue |
|
|
|
} else { |
|
|
|
return valueMap[key] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func getMapKeyStringValue(key string, valueMap map[string]int) int { |
|
|
|
|