Python multiprocessing.pool崩溃的进程 [英] Python multiprocessing.Pool with processes that crash

查看:713
本文介绍了Python multiprocessing.pool崩溃的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,它们不应该崩溃,但是无论如何它们还是会崩溃.有没有办法获得multiprocessing.Pool或任何其他的多处理工具来重新启动终止的进程?否则我该怎么办?

Well, they're not supposed to crash, but they do anyway. Is there a way to get multiprocessing.Pool, or any other multiprocessing tool to re-start a process that dies? How would I do this otherwise?

谢谢!

编辑:一些背景.该过程对Autodesk Maya中的几何图形有很多作用.这样做完全可以.问题是,每隔一段时间,我会有一个文件来决定,一旦完成并打开一个新场景,该文件将完全退出Maya(或mayapy),而没有python警告或错误,也不存在Windows的关键进程错误. .它死了.不幸的是,我真的无能为力.

Edit: Some background. The process does several things with geometry in Autodesk Maya. Which it does totally fine. The problem is that every once in a while I'll have a file that decides, once it's finished and a new scene is being opened, to completely exit Maya (or mayapy) with no python warnings or errors, or critical process errors from Windows. It just dies. There's not really anything I can do about the crashing unfortunately.

我希望的是一种重新启动因崩溃而死亡的进程的方法.

What I'm hoping for is a way to re-start any processes that have died from a crash.

推荐答案

显然,最近他们改变了Python 3.3的行为,在这种情况下引发了异常: http://hg.python.org/cpython/rev/6d6099f7fe89

Apparently, recently they've changed the behaviour in Python 3.3, to raise an exception in this case: http://hg.python.org/cpython/rev/6d6099f7fe89

导致此票证的缺陷是: http://bugs.python.org/issue9205

The defect that lead to this ticket is: http://bugs.python.org/issue9205

但是,如果手动生成工作程序(在使用多处理程序时通常会这样做),则可以尝试使用Process.is_alive()函数: http://docs.python.org/dev/library/multiprocessing#multiprocessing .Process.is_alive

However, if you manually spawn the workers (which I usually do when I use multiprocessing), you may try to use the Process.is_alive() function: http://docs.python.org/dev/library/multiprocessing#multiprocessing.Process.is_alive

这篇关于Python multiprocessing.pool崩溃的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆