Gracefull python joblib kill

牧云@^-^@ 提交于 2019-12-06 04:50:41

问题


Is it possible to gracefully kill a joblib process (threading backend), and still return the so far computed results ?

parallel = Parallel(n_jobs=4, backend="threading")
result = parallel(delayed(dummy_f)(x) for x in range(100))

For the moment I came up with two solutions

  • parallel._aborted = True which waits for the started jobs to finish (in my case it can be very long)
  • parallel._terminate_backend() which hangs if jobs are still in the pipe (parallel._jobs not empty)

Is there a way to workaround the lib to do this ?

来源:https://stackoverflow.com/questions/42702199/gracefull-python-joblib-kill

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