def handle(self, *args, **options):
    self.args = args
    self.options = options
    self.mailer = utils.mail.Mailer(options)

    self.stdout.write("args: %r\n" % (args, ))
    self.stdout.write("options: %r\n" % options)

    self.collector_config = CollectorConfig(self.args, self.options)

    self.last_status = {}
    try:
      self.last_status = json.load(open(STATUS_FILE_PATH, 'r'))
    except Exception as e:
      logger.warning('Failed to load status file: %r', e)

    status_checker = StatusChecker(self.collector_config,
                                   self.last_status,
                                   self.options,
                                   self.mailer)

    while True:
      try:
        status_checker.check_status()
      except Exception as e:
        logger.warning('OWL cluster checker error: %r', e)
        # send alert email when program got error
        admin_email = ''
        try:
          admin_email = settings.ADMINS[0][1]
        except:
          pass
        self.mailer.send_email(subject = 'OWL cluster check error',
                               content = repr(e),
                               to_email = admin_email,
                              )
      time.sleep(int(self.options['period']))
dataset/ETHPy150Open XiaoMi/minos/owl/alert/management/commands/alert.py/Command.handle/original