I need to send an alert (mail) if a process (python code开发者_StackOverflow) takes more than 5 minutes to execute, and also process should continue to run after sending alert !! I am using time.time() for timer, How can it be implemented ?
I don't know how to implement it using time.time(), but I suggest that you look at the signal module. First thing you need to do is to set up the handler via signal.signal(signal.SIGALRM, your_signal_handler_function)
, and then schedule the SIGALARM to be sent to your process in 300 seconds via signal.alarm(300)
.
This will work only on Unix, though.
精彩评论