重写了connect通信程序与服务器通信系统,彻底重写了终端节点集群,对整个系统进行了较大幅度的优化

master
wufayuan 2 years ago
parent ae894c1fc0
commit f7c0dd043d

@ -1,13 +1,14 @@
import json
import multiprocessing
import socket
import struct
import sys
import threading
from configparser import ConfigParser
from json import JSONDecoder
from msedge.selenium_tools import Edge
from msedge.selenium_tools import EdgeOptions
sys.path.append(r'F:\Users\28587\dcs')
from dcs.tests.zhiwang import *
from dcs.tools import message_process as mp
@ -76,7 +77,7 @@ def crawl(request_map) -> dict:
return result_map
class Client(threading.Thread):
class Client(multiprocessing.Process):
def __init__(self, server_ip, server_port, local_ip, local_port):
super(Client, self).__init__()
self.server_ip = server_ip

File diff suppressed because one or more lines are too long

@ -92,8 +92,8 @@ class Crawler(threading.Thread):
def run(self) -> None:
try:
# self.crawl_zhiwang(user_name=self.partial_task.cui.user_name)
self.test_simulation(user_name=self.partial_task.cui.user_name)
self.crawl_zhiwang(user_name=self.partial_task.cui.user_name)
# self.test_simulation(user_name=self.partial_task.cui.user_name)
except Exception as e:
logger.error(f'[ERROR] {str(e)}')
finally:
@ -145,7 +145,6 @@ class Spider_task(threading.Thread):
pages_start = pages_end
tmp['pages_end'] = pages_start
self.partial_tasks.append(Spider_partial_task(self, tmp))
logger.info(f'[TASK] all tasks: {self.partial_tasks}')
def is_all_task_crawled(self):
for task in self.partial_tasks:

@ -137,7 +137,7 @@ function execute(cmd) { //调用cmd命令
})
}
app.post('/check', function (req, res) {
execute('python connect.py --ip 127.0.0.1 --port 7777 crawling --word computer --cookie god --pages_start 1 --pages_end 3');
execute('python connect.py --ip 127.0.0.1 --port 7777 crawling --word computer --cookie god --pages_start 1 --pages_end 5');
fs.readFile('./result.json', 'utf-8', function (err, data) {
if (err) {
console.error(err);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save