本文整理汇总了Java中org.apache.hadoop.mapreduce.v2.app.MRAppMaster类的典型用法代码示例。如果您正苦于以下问题:Java MRAppMaster类的具体用法?Java MRAppMaster怎么用?Java MRAppMaster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MRAppMaster类属于org.apache.hadoop.mapreduce.v2.app包,在下文中一共展示了MRAppMaster类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testHandlingFinishedContainers
import org.apache.hadoop.mapreduce.v2.app.MRAppMaster; //导入依赖的package包/类
/**
* MAPREDUCE-6771. Test if RMContainerAllocator generates the events in the
* right order while processing finished containers.
*/
@Test
public void testHandlingFinishedContainers() {
EventHandler eventHandler = mock(EventHandler.class);
AppContext context = mock(MRAppMaster.RunningAppContext.class);
when(context.getClock()).thenReturn(new ControlledClock());
when(context.getClusterInfo()).thenReturn(
new ClusterInfo(Resource.newInstance(10240, 1)));
when(context.getEventHandler()).thenReturn(eventHandler);
RMContainerAllocator containerAllocator =
new RMContainerAllocatorForFinishedContainer(null, context);
ContainerStatus finishedContainer = ContainerStatus.newInstance(
mock(ContainerId.class), ContainerState.COMPLETE, "", 0);
containerAllocator.processFinishedContainer(finishedContainer);
InOrder inOrder = inOrder(eventHandler);
inOrder.verify(eventHandler).handle(
isA(TaskAttemptDiagnosticsUpdateEvent.class));
inOrder.verify(eventHandler).handle(isA(TaskAttemptEvent.class));
inOrder.verifyNoMoreInteractions();
}
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TestRMContainerAllocator.java
示例2: verifyClassLoader
import org.apache.hadoop.mapreduce.v2.app.MRAppMaster; //导入依赖的package包/类
/**
* Verifies that the class was loaded by the job classloader if it is in the
* context of the MRAppMaster, and if not throws an exception to fail the
* job.
*/
private void verifyClassLoader(Class<?> cls) {
// to detect that it is instantiated in the context of the MRAppMaster, we
// inspect the stack trace and determine a caller is MRAppMaster
for (StackTraceElement e: new Throwable().getStackTrace()) {
if (e.getClassName().equals(MRAppMaster.class.getName()) &&
!(cls.getClassLoader() instanceof ApplicationClassLoader)) {
throw new ExceptionInInitializerError("incorrect classloader used");
}
}
}
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestMRJobs.java
注:本文中的org.apache.hadoop.mapreduce.v2.app.MRAppMaster类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论