private ContainerLaunchContextPBImpl convertFromProtoFormat( ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextPBImpl convertFromProtoFormat(ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextPBImpl convertFromProtoFormat( ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextPBImpl convertFromProtoFormat( ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextPBImpl convertFromProtoFormat(ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextPBImpl convertFromProtoFormat(ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextPBImpl convertFromProtoFormat(ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
protected RMApp storeApp(RMStateStore store, ApplicationId appId, long submitTime, long startTime) throws Exception { ApplicationSubmissionContext context = new ApplicationSubmissionContextPBImpl(); context.setApplicationId(appId); context.setAMContainerSpec(new ContainerLaunchContextPBImpl()); RMApp mockApp = mock(RMApp.class); when(mockApp.getApplicationId()).thenReturn(appId); when(mockApp.getSubmitTime()).thenReturn(submitTime); when(mockApp.getStartTime()).thenReturn(startTime); when(mockApp.getApplicationSubmissionContext()).thenReturn(context); when(mockApp.getUser()).thenReturn("test"); when(mockApp.getCallerContext()) .thenReturn(new CallerContext.Builder("context").build()); store.storeNewApplication(mockApp); return mockApp; }
@Test public void testCLCPBImplNullEnv() throws IOException { Map<String, LocalResource> localResources = Collections.emptyMap(); Map<String, String> environment = new HashMap<String, String>(); List<String> commands = Collections.emptyList(); Map<String, ByteBuffer> serviceData = Collections.emptyMap(); Credentials containerCreds = new Credentials(); DataOutputBuffer dob = new DataOutputBuffer(); containerCreds.writeTokenStorageToStream(dob); ByteBuffer containerTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); Map<ApplicationAccessType, String> acls = Collections.emptyMap(); environment.put("testCLCPBImplNullEnv", null); ContainerLaunchContext clc = ContainerLaunchContext.newInstance(localResources, environment, commands, serviceData, containerTokens, acls); ContainerLaunchContext clcProto = new ContainerLaunchContextPBImpl( ((ContainerLaunchContextPBImpl) clc).getProto()); Assert.assertEquals("", clcProto.getEnvironment().get("testCLCPBImplNullEnv")); }
private void finishAppWithAttempts(RMState state, RMStateStore store, TestDispatcher dispatcher, ApplicationAttemptId attemptId, long submitTime, long startTime, int amExitStatus, long finishTime, boolean createNewApp) throws Exception { ApplicationId appId = attemptId.getApplicationId(); ApplicationStateData appStateNew = null; if (createNewApp) { ApplicationSubmissionContext context = new ApplicationSubmissionContextPBImpl(); context.setApplicationId(appId); context.setAMContainerSpec(new ContainerLaunchContextPBImpl()); appStateNew = createAppState(context, submitTime, startTime, finishTime, true); } else { ApplicationStateData appState = state.getApplicationState().get(appId); appStateNew = createAppState(appState.getApplicationSubmissionContext(), submitTime, startTime, finishTime, true); appStateNew.attempts.putAll(appState.attempts); } store.updateApplicationState(appStateNew); waitNotify(dispatcher); Container container = new ContainerPBImpl(); container.setId(ContainerId.newContainerId(attemptId, 1)); ApplicationAttemptStateData newAttemptState = createFinishedAttempt(attemptId, container, startTime, amExitStatus); updateAttempt(store, dispatcher, newAttemptState); }
private void pruneAppState(ApplicationStateData appState) { ApplicationSubmissionContext srcCtx = appState.getApplicationSubmissionContext(); ApplicationSubmissionContextPBImpl context = new ApplicationSubmissionContextPBImpl(); // most fields in the ApplicationSubmissionContext are not needed, // but the following few need to be present for recovery to succeed context.setApplicationId(srcCtx.getApplicationId()); context.setResource(srcCtx.getResource()); context.setQueue(srcCtx.getQueue()); context.setAMContainerResourceRequests( srcCtx.getAMContainerResourceRequests()); context.setApplicationName(srcCtx.getApplicationName()); context.setPriority(srcCtx.getPriority()); context.setApplicationTags(srcCtx.getApplicationTags()); context.setApplicationType(srcCtx.getApplicationType()); context.setUnmanagedAM(srcCtx.getUnmanagedAM()); context.setNodeLabelExpression(srcCtx.getNodeLabelExpression()); ContainerLaunchContextPBImpl amContainerSpec = new ContainerLaunchContextPBImpl(); amContainerSpec.setApplicationACLs( srcCtx.getAMContainerSpec().getApplicationACLs()); context.setAMContainerSpec(amContainerSpec); appState.setApplicationSubmissionContext(context); } }
new ApplicationSubmissionContextPBImpl(); dummyContext.setApplicationId(dummyAppId); dummyContext.setAMContainerSpec(new ContainerLaunchContextPBImpl()); ApplicationStateData dummyApp = ApplicationStateData.newInstance(appState.getSubmitTime(),
ctx.setQueue("a_queue"); ContainerLaunchContextPBImpl containerLaunchCtx = new ContainerLaunchContextPBImpl(); containerLaunchCtx.setCommands(Collections.singletonList("a_command")); ctx.setAMContainerSpec(containerLaunchCtx);