1 from __future__
import print_function
2 from builtins
import str
17 from threading
import Timer
18 from BaseMTTUtility
import *
32 BaseMTTUtility.__init__(self)
35 self.
options[
'timeout'] = (timeout,
"Time in seconds before generating exception")
45 lines = testDef.printOptions(self.
options)
52 if not self.
timer or not self.timer.is_alive():
53 self.
timer = Timer(int(self.timeout.total_seconds()),
70 IPlugin.activate(self)
76 IPlugin.deactivate(self)
83 if self.
testDef: self.testDef.plugin_trans_sem.acquire()
84 os.kill(os.getpid(), signal.SIGINT)
87 if isinstance(timeout, int):
88 return datetime.timedelta(0, timeout)
89 if isinstance(timeout, basestring):
90 timeparts = timeout.split(
":")
94 secs = int(timeparts[-1])
95 secs += int(timeparts[-2])*60
96 secs += int(timeparts[-3])*60*60
97 days = int(timeparts[-4])
100 return datetime.timedelta(days, secs)
105 testDef.logger.verbose_print(
"Watchdog Execute")
107 testDef.parseOptions(log, self.
options, keyvals, cmds)
113 log[
'stderr'] =
"Could not parse time input from ini file for Watchdog"
117 log[
'stderr'] =
"Could not parse time input from ini file for Watchdog"