Why threads stopped in heroku?

大城市里の小女人 提交于 2020-01-06 05:34:12

问题


I have been uploaded my project in heroku, and my script create 4 threads, each thread perform specific task, but sometimes log file tells me that some threads stopped like this, (Thread 13)!

How can I solve it? this is the code!

      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, args=(data, "E", manager.result, lock))
      thread3 = ThreadWithLogAndControls(target=segmentationProcess.serchSkills, args=(data, "S", manager.result, lock))
      thread4 = ThreadWithLogAndControls(target=segmentationProcess.searchOthers, args=(data, "O", manager.result, lock))
      thread1.start()
      thread2.start()
      thread3.start()
      thread4.start()
      thread1.join()
      thread2.join()
      thread3.join()
      thread4.join()

Am using nbmultitask library for creating threads, it's like multiprocessing. https://github.com/micahscopes/nbmultitask

来源:https://stackoverflow.com/questions/58941098/why-threads-stopped-in-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!