def check_yarn_cluster_status(self, cluster):
    job = cluster.jobs["resourcemanager"]
    for task in job.running_tasks.itervalues():
      # update cluster entry
      cluster.entry = '%s:%d' % (task.host, task.port)
    if job.running_tasks_count < 1:
      job.last_status = Status.ERROR
      job.last_message = "No running resourcemanager!"

    job = cluster.jobs["proxyserver"]
    if job.running_tasks_count < 1:
      job.last_status = Status.ERROR
      job.last_message = "No running proxyserver!"

    job = cluster.jobs["nodemanager"]
    if job.running_tasks_count < 3:
      job.last_status = Status.ERROR
      job.last_message = "Too few running nodemanager!"
    cluster.last_status = max([job.last_status for job in cluster.jobs.itervalues()])

    job = cluster.jobs["historyserver"]
    if job.running_tasks_count < 1:
      job.last_status = Status.ERROR
      job.last_message = "Too few running historyserver!"
    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_yarn_cluster_status/original