我已经在heroku中上载了我的项目,我的脚本创建了4个线程,每个线程执行特定的任务,但是有时日志文件告诉我某些线程像这样停止了(线程13)!
我该如何解决? 这是代码!
segmentationProcess = SegmentationProcess()
dataList = request.body.decode("utf-8").split(',')
data = segmentationProcess.preProcess(dataList)
lock = multiprocessing.Lock()
thread1 = ThreadWithLogAndControls(target=segmentationProcess.searchWorkExperience,args=(data,"W",manager.result,lock))
thread2 = ThreadWithLogAndControls(target=segmentationProcess.searchEducation,"E",lock))
thread3 = ThreadWithLogAndControls(target=segmentationProcess.serchSkills,"S",lock))
thread4 = ThreadWithLogAndControls(target=segmentationProcess.searchOthers,"O",lock))
thread1.start()
thread2.start()
thread3.start()
thread4.start()
thread1.join()
thread2.join()
thread3.join()
thread4.join()
使用nbmultitask库创建线程,就像多处理。 https://github.com/micahscopes/nbmultitask