def sourceWatchdog(self):
        for i, source in enumerate(self.sources):
            if not source.config.get('watchdog', False):
                continue 
            sn = repr(source)
            last = self.lastEvents.get(source, None)
            if last:
                try:
                    if last < (time.time()-(source.inter*10)):
                        log.msg("Trying to restart stale source %s: %ss" % (
                            sn, int(time.time() - last)
                        ))

                        s = self.sources.pop(i)
                        try:
                            s.t.stop()
                        except Exception, e:
                            log.msg("Could not stop timer for %s: %s" % (
                                sn, e))

                        config = copy.deepcopy(s.config)

                        del self.lastEvents[source]
                        del s, source

                        source = self.createSource(config)

                        reactor.callLater(0, self._startSource, source)
                except Exception, e:
                    log.msg("Could not reset source %s: %s" % (
                        sn, e))
Watchdog timer function. 
dataset/ETHPy150Open calston/tensor/tensor/service.py/TensorService.sourceWatchdog