Example usage for org.apache.hadoop.yarn.server.resourcemanager.scheduler SchedulerApplicationAttempt getRMContainer

List of usage examples for org.apache.hadoop.yarn.server.resourcemanager.scheduler SchedulerApplicationAttempt getRMContainer

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.server.resourcemanager.scheduler SchedulerApplicationAttempt getRMContainer.

Prototype

public RMContainer getRMContainer(ContainerId id) 

Source Link

Usage

From source file:org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor.java

License:Apache License

@Override
public void beforeReleaseContainers(List<ContainerId> containers, SchedulerApplicationAttempt attempt) {
    if (containers != null && attempt != null) {
        for (YarnSchedulerInterceptor interceptor : interceptors.values()) {
            List<ContainerId> filteredContainers = new ArrayList<>();
            for (ContainerId containerId : containers) {
                NodeId nodeId = attempt.getRMContainer(containerId).getContainer().getNodeId();
                if ((nodeId != null && interceptor.getCallBackFilter().allowCallBacksForNode(nodeId))) {
                    filteredContainers.add(containerId);
                }/*from  w w  w  .j  av a 2s  .c  o  m*/
            }
            if (!filteredContainers.isEmpty()) {
                interceptor.beforeReleaseContainers(filteredContainers, attempt);
            }
        }
    }
}