Example usage for org.apache.hadoop.yarn.api.records NodeReport getLastHealthReportTime

List of usage examples for org.apache.hadoop.yarn.api.records NodeReport getLastHealthReportTime

Introduction

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

Prototype

@Public
@Stable
public abstract long getLastHealthReportTime();

Source Link

Document

Get the last timestamp at which the health report was received.

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  2s.  co 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);
}