def check_hdfs_cluster_status(self, cluster):
    job = cluster.jobs["journalnode"]
    if (job.running_tasks_count < 2 or
        (job.total_tasks_count / 2 + 1) < job.running_tasks_count):
      job.last_status = Status.ERROR
      job.last_message = "Too few running journalnodes!"

    job = cluster.jobs["namenode"]
    if job.running_tasks_count < 1:
      job.last_status = Status.ERROR
      job.last_message = "No running namenodes!"
    else:
      active = 0
      for task in job.running_tasks.itervalues():
        if self.is_namenode_active(task):
          # update cluster entry
          cluster.entry = '%s:%d' % (task.host, task.port)
          cluster.version = self.get_latest_metric(task,
                                                   'Hadoop:service=NameNode,name=NameNodeInfo',
                                                   'Version')
          active += 1
      if active > 1:
        job.last_status = Status.ERROR
        job.last_message = "Too many active namenodes!"
      elif active < 1:
        job.last_status = Status.ERROR
        job.last_message = "No active namenodes!"
      elif job.running_tasks_count < 2:
        job.last_status = Status.WARN
        job.last_message = "Less than 2 running namenodes, no HA guarantee"

    job = cluster.jobs["datanode"]
    if job.running_tasks_count < 3:
      job.last_status = Status.ERROR
      job.last_message = "Too few running datanodes!"
    cluster.last_status = max([job.last_status for job in cluster.jobs.itervalues()])
dataset/ETHPy150Open XiaoMi/minos/owl/alert/management/commands/alert.py/StatusChecker.check_hdfs_cluster_status/swapped operands of `<`