detection of communication failure when "put" in queue
I am using the multiprocessing
python module with Queue
for communic开发者_JAVA百科ation between processes. Some processes only send (i.e. queue.put
) and I can't seem to find a way to detect when the receiving end gets terminated abruptly.
Is there a way to detect if the process at the other end of the Queue gets terminated without having to get
from the Queue? Isn't there a signal I could trap somehow? Or do I have to periodically get
from the Queue and trap the EOFError
manually.
I don't believe multiprocessing
sets up a "watch-dog" process for you to take care of crashes or kills of some of your processes. It may be worth your while to set one up (pretty hard to do cross-platform, but if, say, you're only worried about Linux, it's not that terrible).
精彩评论