Search in sources :

Example 1 with ContainersMonitorImpl

use of org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl in project hadoop by apache.

the class TestContainerSchedulerQueuing method createContainerManager.

@Override
protected ContainerManagerImpl createContainerManager(DeletionService delSrvc) {
    return new ContainerManagerImpl(context, exec, delSrvc, nodeStatusUpdater, metrics, dirsHandler) {

        @Override
        public void setBlockNewContainerRequests(boolean blockNewContainerRequests) {
        // do nothing
        }

        @Override
        protected UserGroupInformation getRemoteUgi() throws YarnException {
            ApplicationId appId = ApplicationId.newInstance(0, 0);
            ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId, 1);
            UserGroupInformation ugi = UserGroupInformation.createRemoteUser(appAttemptId.toString());
            ugi.addTokenIdentifier(new NMTokenIdentifier(appAttemptId, context.getNodeId(), user, context.getNMTokenSecretManager().getCurrentKey().getKeyId()));
            return ugi;
        }

        @Override
        protected ContainersMonitor createContainersMonitor(ContainerExecutor exec) {
            return new ContainersMonitorImpl(exec, dispatcher, this.context) {

                // Define resources available for containers to be executed.
                @Override
                public long getPmemAllocatedForContainers() {
                    return 2048 * 1024 * 1024L;
                }

                @Override
                public long getVmemAllocatedForContainers() {
                    float pmemRatio = getConfig().getFloat(YarnConfiguration.NM_VMEM_PMEM_RATIO, YarnConfiguration.DEFAULT_NM_VMEM_PMEM_RATIO);
                    return (long) (pmemRatio * getPmemAllocatedForContainers());
                }

                @Override
                public long getVCoresAllocatedForContainers() {
                    return 4;
                }
            };
        }
    };
}
Also used : ContainerManagerImpl(org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl) NMTokenIdentifier(org.apache.hadoop.yarn.security.NMTokenIdentifier) DefaultContainerExecutor(org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor) ContainerExecutor(org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor) ContainersMonitorImpl(org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 NMTokenIdentifier (org.apache.hadoop.yarn.security.NMTokenIdentifier)1 ContainerExecutor (org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor)1 DefaultContainerExecutor (org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor)1 ContainerManagerImpl (org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl)1 ContainersMonitorImpl (org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl)1