def StartLoop(self, device):
    logger = logging.LoggerAdapter(logging.getLogger(), {'scenario': self.name})

    def _OnComplete():
      self._timeout = IOLoop.current().add_timeout(time.time() + self.frequency, _RunIteration)

    def _OnException(typ, val, tb):
      if (typ, val, tb) != (None, None, None):
        if typ is web.HTTPError:
          message = self._http_error_dict.get(val.status_code,
                                              'HTTP status %d received from viewfinder: %s' %
                                              (val.status_code, val.log_message))
          logger.error(message)
        else:
          logger.error('Unknown exception in scenario %s', self.name, exc_info=(typ, val, tb))
      _OnComplete()

    def _RunIteration():
      with util.Barrier(_OnComplete, _OnException) as b:
        self.handler(device, logger, b.Callback())

    _RunIteration()
Start this scenario.  It will run at the configured frequency until StopLoop() is called.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/watchdog/scenario.py/Scenario.StartLoop