|
@@ -19,6 +19,9 @@ from spider.PromoterInfoSpider import PromoterInfoSpider
|
|
|
from spider.PromoterLiveInfoSpider import PromoterLiveInfoSpider
|
|
|
from spider.PromoterVideoAnalysisInfo import PromoterVideoAnalysisInfo
|
|
|
from spider.PromoterVideoAnalysisTrend import PromoterVideoAnalysisTrend
|
|
|
+from multiprocessing import Process
|
|
|
+
|
|
|
+from spider.ReturnPromoterInfoSpider import ReturnPromoterInfoSpider
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
@@ -31,14 +34,21 @@ def api_root():
|
|
|
def webhook_get_promoter():
|
|
|
rep = json.loads(request.data)
|
|
|
promoterId = rep["promoterId"]
|
|
|
- pool = ThreadPoolExecutor(max_workers=10)
|
|
|
- result = PromoterInfoSpider().PromoterInfoSpiderHandler(promoterId=promoterId)
|
|
|
- pool.submit(PromoterFansInfo().PromoterFansInfoHandler(promoterId=promoterId))
|
|
|
- pool.submit(PromoterLiveInfoSpider().PromoterLiveInfoSpiderHander(promoterId=promoterId))
|
|
|
- pool.submit(PromoterVideoAnalysisInfo().PromoterVideoAnalysisInfoHandler(promoterId=promoterId))
|
|
|
- pool.submit(PromoterVideoAnalysisTrend().PromoterVideoAnalysisTrendHandler(promoterId=promoterId))
|
|
|
- pool.shutdown()
|
|
|
- return result
|
|
|
+ # pool = multiprocessing.Pool(4)
|
|
|
+ # m = multiprocessing.Manager()
|
|
|
+ print(time.time(), 'p0----')
|
|
|
+ reuslt = ReturnPromoterInfoSpider().PromoterInfoSpiderHandler(promoterId)
|
|
|
+ p1 = Process(target=PromoterInfoSpider().PromoterInfoSpiderHandler, args=(promoterId,))
|
|
|
+ p2 = Process(target=PromoterFansInfo().PromoterFansInfoHandler, args=(promoterId,))
|
|
|
+ p3 = Process(target=PromoterLiveInfoSpider().PromoterLiveInfoSpiderHander, args=(promoterId,))
|
|
|
+ p4 = Process(target=PromoterVideoAnalysisInfo().PromoterVideoAnalysisInfoHandler, args=(promoterId,))
|
|
|
+ p5 = Process(target=PromoterVideoAnalysisTrend().PromoterVideoAnalysisTrendHandler, args=(promoterId,))
|
|
|
+ p1.start()
|
|
|
+ p2.start()
|
|
|
+ p3.start()
|
|
|
+ p4.start()
|
|
|
+ p5.start()
|
|
|
+ return reuslt
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|