def heartbeat(self): """Checks module run time for each event loop""" timeout_sec = self._get_test_timeout(self.test_name) if not timeout_sec or not self.test_start: return timeout = gcp.parse_timestamp( self.test_start) + timedelta(seconds=timeout_sec) nowtime = gcp.parse_timestamp(gcp.get_timestamp()) if nowtime >= timeout: if self.timeout_handler: LOGGER.error('Monitoring timeout for %s after %ds', self.test_name, timeout_sec) # ensure it's called once handler, self.timeout_handler = self.timeout_handler, None handler()
def check_module_timeout(self): """Checks module run time for each event loop""" timeout_sec = self._get_test_timeout(self.test_name) if not timeout_sec or not self.test_start: return delta_sec = timedelta(seconds=timeout_sec) timeout = gcp.parse_timestamp(self.test_start) + delta_sec if datetime.fromtimestamp(time.time()) >= timeout: if self.timeout_handler: LOGGER.error('Monitoring timeout for %s after %ds', self.test_name, timeout_sec) # ensure it's called once handler, self.timeout_handler = self.timeout_handler, None handler()