Reputation: 10257
When using Python multiprocessing, what is the proper way to ensure code will run to cleanup whenever a process exits (both cleanly or on fatal error.)
If I am writing my processes as inheriting from the Process
object, should I put this functionality in the __del__
method of the object? I tried putting simple log statements into terminate
, but it doesn't seem to execute when the script receives a SIGHUP or KeyboardInterrupt
.
Upvotes: 1
Views: 260