org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl Java Examples

The following examples show how to use org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContainerResourceMonitoringTracerTest.java    From garmadon with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws IOException, ClassNotFoundException {
    classLoader = new ByteArrayClassLoader.ChildFirst(getClass().getClassLoader(),
            ClassFileExtraction.of(
                    Tracer.class,
                    MethodTracer.class,
                    ContainerResourceMonitoringTracer.class,
                    ContainerResourceMonitoringTracer.VcoreUsageTracer.class,
                    Class.forName(ContainerResourceMonitoringTracer.VcoreUsageTracer.class.getName() + "$SingletonHolder"),
                    ContainersMonitorImpl.class,
                    Class.forName(ContainersMonitorImpl.class.getName() + "$MonitoringThread"),
                    ContainerMetrics.class,
                    Class.forName(ContainerMetrics.class.getName() + "$1")
            ),
            ByteArrayClassLoader.PersistenceHandler.MANIFEST);
}
 
Example #2
Source File: ContainerResourceMonitoringTracerTest.java    From garmadon with Apache License 2.0 5 votes vote down vote up
@Test
@AgentAttachmentRule.Enforce
public void ContainerResourceMonitoringModule_should_attach_to_isProcessTreeOverLimit() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
    assertThat(ByteBuddyAgent.install(), instanceOf(Instrumentation.class));

    final Header[] header = new Header[1];
    final Object[] event = new Object[1];
    ContainerResourceMonitoringTracer.initEventHandler((t, h, o) -> {
        header[0] = h;
        event[0] = o;
    });
    ClassFileTransformer classFileTransformer = new ContainerResourceMonitoringTracer.MemorySizeTracer().installOnByteBuddyAgent();

    try {
        ContainerExecutor exec = mock(ContainerExecutor.class);
        AsyncDispatcher dispatcher = mock(AsyncDispatcher.class);
        Context ctx = mock(Context.class);

        Class<?> clazz = classLoader.loadClass(ContainersMonitorImpl.class.getName());
        Method m = clazz.getDeclaredMethod("isProcessTreeOverLimit", String.class, long.class, long.class, long.class);
        Object inFormat = clazz.getConstructor(ContainerExecutor.class, AsyncDispatcher.class, Context.class).newInstance(exec, dispatcher, ctx);

        m.setAccessible(true);
        m.invoke(inFormat, "container_e600_1516870220739_0069_01_000032", 2000, 1000, 3000);

        assertNotNull(header[0]);
        assertNotNull(event[0]);

    } finally {
        ByteBuddyAgent.getInstrumentation().removeTransformer(classFileTransformer);
    }
}
 
Example #3
Source File: ContainerManagerImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public ContainerManagerImpl(Context context, ContainerExecutor exec,
    DeletionService deletionContext, NodeStatusUpdater nodeStatusUpdater,
    NodeManagerMetrics metrics, ApplicationACLsManager aclsManager,
    LocalDirsHandlerService dirsHandler) {
  super(ContainerManagerImpl.class.getName());
  this.context = context;
  this.dirsHandler = dirsHandler;

  // ContainerManager level dispatcher.
  dispatcher = new AsyncDispatcher();
  this.deletionService = deletionContext;
  this.metrics = metrics;

  rsrcLocalizationSrvc =
      createResourceLocalizationService(exec, deletionContext, context);
  addService(rsrcLocalizationSrvc);

  containersLauncher = createContainersLauncher(context, exec);
  addService(containersLauncher);

  this.nodeStatusUpdater = nodeStatusUpdater;
  this.aclsManager = aclsManager;

  // Start configurable services
  auxiliaryServices = new AuxServices();
  auxiliaryServices.registerServiceListener(this);
  addService(auxiliaryServices);

  this.containersMonitor =
      new ContainersMonitorImpl(exec, dispatcher, this.context);
  addService(this.containersMonitor);

  dispatcher.register(ContainerEventType.class,
      new ContainerEventDispatcher());
  dispatcher.register(ApplicationEventType.class,
      new ApplicationEventDispatcher());
  dispatcher.register(LocalizationEventType.class, rsrcLocalizationSrvc);
  dispatcher.register(AuxServicesEventType.class, auxiliaryServices);
  dispatcher.register(ContainersMonitorEventType.class, containersMonitor);
  dispatcher.register(ContainersLauncherEventType.class, containersLauncher);
  
  addService(dispatcher);

  ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
  this.readLock = lock.readLock();
  this.writeLock = lock.writeLock();
}
 
Example #4
Source File: ContainerManagerImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public ContainerManagerImpl(Context context, ContainerExecutor exec,
    DeletionService deletionContext, NodeStatusUpdater nodeStatusUpdater,
    NodeManagerMetrics metrics, ApplicationACLsManager aclsManager,
    LocalDirsHandlerService dirsHandler) {
  super(ContainerManagerImpl.class.getName());
  this.context = context;
  this.dirsHandler = dirsHandler;

  // ContainerManager level dispatcher.
  dispatcher = new AsyncDispatcher();
  this.deletionService = deletionContext;
  this.metrics = metrics;

  rsrcLocalizationSrvc =
      createResourceLocalizationService(exec, deletionContext, context);
  addService(rsrcLocalizationSrvc);

  containersLauncher = createContainersLauncher(context, exec);
  addService(containersLauncher);

  this.nodeStatusUpdater = nodeStatusUpdater;
  this.aclsManager = aclsManager;

  // Start configurable services
  auxiliaryServices = new AuxServices();
  auxiliaryServices.registerServiceListener(this);
  addService(auxiliaryServices);

  this.containersMonitor =
      new ContainersMonitorImpl(exec, dispatcher, this.context);
  addService(this.containersMonitor);

  dispatcher.register(ContainerEventType.class,
      new ContainerEventDispatcher());
  dispatcher.register(ApplicationEventType.class,
      new ApplicationEventDispatcher());
  dispatcher.register(LocalizationEventType.class, rsrcLocalizationSrvc);
  dispatcher.register(AuxServicesEventType.class, auxiliaryServices);
  dispatcher.register(ContainersMonitorEventType.class, containersMonitor);
  dispatcher.register(ContainersLauncherEventType.class, containersLauncher);
  
  addService(dispatcher);

  ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
  this.readLock = lock.readLock();
  this.writeLock = lock.writeLock();
}