|
@@ -441,6 +441,7 @@ func saveLua(o map[string]interface{}) bool {
|
|
|
"important": false,
|
|
|
"returnreason": "",
|
|
|
"claimrecovertype": 0,
|
|
|
+ "source": "爬虫指定维护人导入",
|
|
|
}
|
|
|
} else {
|
|
|
param["recovertime"] = int64(0) //回收时间
|
|
@@ -764,6 +765,7 @@ func (f *Front) Assign() {
|
|
|
"important": spiderimportant,
|
|
|
"returnreason": "",
|
|
|
"claimrecovertype": 0,
|
|
|
+ "source": "分配爬虫回收",
|
|
|
}
|
|
|
save = append(save, recovelog)
|
|
|
}
|
|
@@ -784,6 +786,7 @@ func (f *Front) Assign() {
|
|
|
"important": spiderimportant,
|
|
|
"returnreason": "",
|
|
|
"claimrecovertype": 0,
|
|
|
+ "source": "分配爬虫认领",
|
|
|
}
|
|
|
save = append(save, claimlog)
|
|
|
} else if platform != "golua平台" && platform != "chrome" { //分配到其他平台改为历史爬虫
|
|
@@ -1016,12 +1019,17 @@ func (f *Front) UpdateESP() {
|
|
|
if val != "golua平台" && val != "chrome" {
|
|
|
b := u.MgoS.Update("spider_heart", map[string]interface{}{"code": code}, map[string]interface{}{"$set": map[string]interface{}{"del": true}}, false, true)
|
|
|
qu.Debug("Del Heart:", b)
|
|
|
- b, err := spider.UpdateSpiderByCodeState(code, "6", qu.IntAll((*one)["event"])) //下架
|
|
|
- if b && err == nil {
|
|
|
- //历史节点下架为了避免线上运行爬虫待完成时改为7000采集历史,但是又转到其他平台,导致原线上运行节点爬虫并未下线,心跳异常
|
|
|
- if incrementevent := (*one)["incrementevent"]; incrementevent != nil {
|
|
|
- b, err = spider.UpdateSpiderByCodeState(code, "6", qu.IntAll(incrementevent))
|
|
|
+ var err error
|
|
|
+ if qu.ObjToString((*one)["platform"]) == "golua平台" {
|
|
|
+ b, err = spider.UpdateSpiderByCodeState(code, "6", qu.IntAll((*one)["event"])) //下架
|
|
|
+ if b && err == nil {
|
|
|
+ //历史节点下架为了避免线上运行爬虫待完成时改为7000采集历史,但是又转到其他平台,导致原线上运行节点爬虫并未下线,心跳异常
|
|
|
+ if incrementevent := (*one)["incrementevent"]; incrementevent != nil {
|
|
|
+ b, err = spider.UpdateSpiderByCodeState(code, "6", qu.IntAll(incrementevent))
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ if b && err == nil {
|
|
|
//关闭任务
|
|
|
u.MgoEB.Update("task", map[string]interface{}{"s_code": code, "i_state": map[string]interface{}{"$in": []int{0, 1, 2, 3, 5}}}, map[string]interface{}{"$set": map[string]interface{}{"i_state": 6}}, false, true)
|
|
|
if b && err == nil {
|
|
@@ -1043,26 +1051,27 @@ func (f *Front) UpdateESP() {
|
|
|
f.Write("n")
|
|
|
return
|
|
|
}
|
|
|
- //lua转python,爬虫认领状态更新
|
|
|
- UpdateLuaClaimtype(code)
|
|
|
- //换平台爬虫回收,保存日志
|
|
|
- recovelog := map[string]interface{}{
|
|
|
- "site": (*one)["site"],
|
|
|
- "code": (*one)["code"],
|
|
|
- "channel": (*one)["channel"],
|
|
|
- "modifyuser": (*one)["modifyuser"],
|
|
|
- "priority": (*one)["priority"],
|
|
|
- "stype": "回收",
|
|
|
- "comeintime": time.Now().Unix(),
|
|
|
- "claimtime": (*one)["claimtime"],
|
|
|
- "recovertime": (*one)["recovertime"],
|
|
|
- "returntime": int64(0),
|
|
|
- "important": (*one)["spiderimportant"],
|
|
|
- "returnreason": "转平台",
|
|
|
- "claimrecovertype": 0,
|
|
|
- }
|
|
|
- u.MgoEB.Save("lua_logs_claim", recovelog)
|
|
|
}
|
|
|
+ //爬虫认领状态更新
|
|
|
+ UpdateLuaClaimtype(code)
|
|
|
+ //换平台爬虫回收,保存日志
|
|
|
+ recovelog := map[string]interface{}{
|
|
|
+ "site": (*one)["site"],
|
|
|
+ "code": (*one)["code"],
|
|
|
+ "channel": (*one)["channel"],
|
|
|
+ "modifyuser": (*one)["modifyuser"],
|
|
|
+ "priority": (*one)["priority"],
|
|
|
+ "stype": "回收",
|
|
|
+ "comeintime": time.Now().Unix(),
|
|
|
+ "claimtime": (*one)["claimtime"],
|
|
|
+ "recovertime": (*one)["recovertime"],
|
|
|
+ "returntime": int64(0),
|
|
|
+ "important": (*one)["spiderimportant"],
|
|
|
+ "returnreason": "转平台",
|
|
|
+ "claimrecovertype": 0,
|
|
|
+ "source": "爬虫转平台回收",
|
|
|
+ }
|
|
|
+ u.MgoEB.Save("lua_logs_claim", recovelog)
|
|
|
} else if w == "priority" { //调整优先级
|
|
|
priority := qu.IntAll(val)
|
|
|
if priority < 0 {
|