Example usage for org.apache.hadoop.yarn.api.records NodeState isUnusable

List of usage examples for org.apache.hadoop.yarn.api.records NodeState isUnusable

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records NodeState isUnusable.

Prototype

public boolean isUnusable() 

Source Link

Usage

From source file:org.apache.slider.server.appmaster.state.NodeInstance.java

License:Apache License

/**
 * Update the node status./*from w  w  w  .  j a  v  a 2 s. c  o m*/
 * The return code is true if the node state changed enough to
 * trigger a re-evaluation of pending requests. That is, either a node
 * became available when it was previously not, or the label changed
 * on an available node.
 *
 * Transitions of a node from live to dead aren't treated as significant,
 * nor label changes on a dead node.
 *
 * @param report latest node report
 * @return true if the node state changed enough for a request evaluation.
 */
public synchronized boolean updateNode(NodeReport report) {
    nodeStateUpdateTime = report.getLastHealthReportTime();
    nodeReport = report;
    NodeState oldState = nodeState;
    boolean oldStateUnusable = oldState.isUnusable();
    nodeState = report.getNodeState();
    boolean newUsable = !nodeState.isUnusable();
    boolean nodeNowAvailable = oldStateUnusable && newUsable;
    String labels = this.nodeLabels;
    nodeLabels = SliderUtils.extractNodeLabel(report);
    return nodeNowAvailable || newUsable && !this.nodeLabels.equals(labels);
}