Example usage for org.apache.hadoop.yarn.server.resourcemanager.rmnode RMNodeStatusEvent getContainers

List of usage examples for org.apache.hadoop.yarn.server.resourcemanager.rmnode RMNodeStatusEvent getContainers

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.server.resourcemanager.rmnode RMNodeStatusEvent getContainers.

Prototype

public List<ContainerStatus> getContainers() 

Source Link

Usage

From source file:org.apache.myriad.scheduler.fgs.NMHeartBeatHandler.java

License:Apache License

@VisibleForTesting
protected Resource getResourcesUnderUse(RMNodeStatusEvent statusEvent) {
    Resource usedResources = Resource.newInstance(0, 0);
    for (ContainerStatus status : statusEvent.getContainers()) {
        if (containerInUse(status)) {
            RMContainer rmContainer = yarnScheduler.getRMContainer(status.getContainerId());
            // (sdaingade) This check is needed as RMContainer information may not be populated
            // immediately after a RM restart.
            if (rmContainer != null) {
                Resources.addTo(usedResources, rmContainer.getAllocatedResource());
            }/* w ww .ja va 2 s .  co m*/
        }
    }
    return usedResources;
}