|
@@ -57,6 +57,7 @@ type NewSpider struct {
|
|
|
Channel string `bson:"channel"`
|
|
|
Platform string `bson:"platform"`
|
|
|
Event int `bson:"event"`
|
|
|
+ Priority int `bson:"priority"`
|
|
|
InfoFormat int `bson:"infoformat"`
|
|
|
PendState int `bson:"pendstate"`
|
|
|
ModifyUser string `bson:"modifyuser"`
|
|
@@ -126,8 +127,8 @@ type WarnInfo struct {
|
|
|
func NewStartTask() {
|
|
|
InitInfo() //初始化时间
|
|
|
logger.Info(StartTime, EndTime, Publishtime)
|
|
|
- getCodeAuditorLog() //获取爬虫上线时间
|
|
|
getCodeBaseInfo() //获取爬虫基本信息
|
|
|
+ getCodeAuditorLog() //获取爬虫上线时间
|
|
|
//getCodeStatus() //获取爬虫响应状态信息
|
|
|
getPythonSummaryInfo() //获取python汇总信息
|
|
|
getLuaSummaryInfo() //获取lua汇总信息
|
|
@@ -205,6 +206,7 @@ func getCodeBaseInfo() {
|
|
|
"codetags": 1,
|
|
|
"infoformat": 1,
|
|
|
"param_common": 1,
|
|
|
+ "priority": 1,
|
|
|
}
|
|
|
it := sess.DB(util.MgoEB.DbName).C("luaconfig_online").Find(&query).Select(&fields).Iter()
|
|
|
n := 0
|
|
@@ -720,7 +722,7 @@ func getSpiderDownloadRateData() {
|
|
|
sp.Page_TwoOk = !(page_fail == alltimes && page_fail > 0)
|
|
|
//列表页
|
|
|
if !sp.List_IsGetData {
|
|
|
- sp.List_IsGetData = sp.List_RunTimes == sp.List_NoDataTimes
|
|
|
+ sp.List_IsGetData = !(sp.List_RunTimes == sp.List_NoDataTimes)
|
|
|
}
|
|
|
}
|
|
|
lock.Unlock()
|
|
@@ -836,6 +838,7 @@ func createTask(sp *NewSpider, taskArr *[][]map[string]interface{}, lock *sync.M
|
|
|
comeintime_old := qu.Int64All(task["l_comeintime"]) //历史任务创建时间
|
|
|
|
|
|
result := map[string]interface{}{
|
|
|
+ "i_priority": sp.Priority,
|
|
|
"i_count": count,
|
|
|
"f_failrate": failRate,
|
|
|
"i_event": sp.Event,
|
|
@@ -890,6 +893,7 @@ func createTask(sp *NewSpider, taskArr *[][]map[string]interface{}, lock *sync.M
|
|
|
"s_platform": sp.Platform,
|
|
|
"i_count": count,
|
|
|
"f_failrate": failRate,
|
|
|
+ "i_priority": sp.Priority,
|
|
|
}
|
|
|
update = append(update, query)
|
|
|
update = append(update, saveMap)
|
|
@@ -1052,25 +1056,29 @@ func downloadRateErr(sp *NewSpider) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else { //lua
|
|
|
+ } else {
|
|
|
if sp.List_AllInTimes > 0 {
|
|
|
errFlag := false
|
|
|
- if sp.Model == 1 { //列表页、详情页分开采集模式
|
|
|
- if !sp.Audit && (sp.MaxPage == 1 || sp.MaxPage > 100) { //分开采集且不是无限翻页,爬虫审核时间超过24小时,记录异常
|
|
|
+ if sp.Platform == PLATFORM_COMM {
|
|
|
+ if !sp.Audit { //通用平台前一天审核的爬虫不建列表页异常任务
|
|
|
errFlag = true
|
|
|
}
|
|
|
- } else if sp.Event != 7410 || sp.Platform != PLATFORM_LUA { //列表页、详情页顺序采集模式(排除7410节点)
|
|
|
- if sp.Platform == PLATFORM_COMM && sp.Audit { //通用平台前一天审核的爬虫不建列表页异常任务
|
|
|
- errFlag = false
|
|
|
- } else if sp.CodeTags != nil {
|
|
|
- tagTime, _ := sp.CodeTags[NEWTASK_RATEERR].(int64)
|
|
|
- if tagTime == 0 { //无频率异常标记
|
|
|
+ } else if sp.Platform == PLATFORM_LUA {
|
|
|
+ if sp.Model == 1 { //列表页、详情页分开采集模式
|
|
|
+ if !sp.Audit && (sp.MaxPage == 1 || sp.MaxPage > 100) { //分开采集且不是无限翻页,爬虫审核时间超过24小时,记录异常
|
|
|
errFlag = true
|
|
|
- } else if tagTime > 0 && tagTime <= util.GetTime(-7) { //标记失效
|
|
|
+ }
|
|
|
+ } else if sp.Event != 7410 { //列表页、详情页顺序采集模式(排除7410节点)
|
|
|
+ if sp.CodeTags != nil {
|
|
|
+ tagTime, _ := sp.CodeTags[NEWTASK_RATEERR].(int64)
|
|
|
+ if tagTime == 0 { //无频率异常标记
|
|
|
+ errFlag = true
|
|
|
+ } else if tagTime > 0 && tagTime <= util.GetTime(-7) { //标记失效
|
|
|
+ errFlag = true
|
|
|
+ }
|
|
|
+ } else { //无标记,记录采集频率异常
|
|
|
errFlag = true
|
|
|
}
|
|
|
- } else { //无标记,记录采集频率异常
|
|
|
- errFlag = true
|
|
|
}
|
|
|
}
|
|
|
if errFlag {
|