private ContainerLaunchContext createAMContainerLaunchContext( ApplicationSubmissionContext applicationMasterContext, ContainerId containerID) throws IOException { // Construct the actual Container ContainerLaunchContext container = applicationMasterContext.getAMContainerSpec(); if (container == null){ throw new IOException(containerID + " has been cleaned before launched"); } // Finalize the container setupTokens(container, containerID); // set the flow context optionally for timeline service v.2 setFlowContext(container); return container; }
private ContainerLaunchContext createAMContainerLaunchContext( ApplicationSubmissionContext applicationMasterContext, ContainerId containerID) throws IOException { // Construct the actual Container ContainerLaunchContext container = applicationMasterContext.getAMContainerSpec(); LOG.info("Command to launch container " + containerID + " : " + StringUtils.arrayToString(container.getCommands().toArray( new String[0]))); // Finalize the container setupTokens(container, containerID); return container; }
private ContainerLaunchContext createAMContainerLaunchContext( ApplicationSubmissionContext applicationMasterContext, ContainerId containerID) throws IOException { // Construct the actual Container ContainerLaunchContext container = applicationMasterContext.getAMContainerSpec(); LOG.info("Command to launch container " + containerID + " : " + StringUtils.arrayToString(container.getCommands().toArray( new String[0]))); // Finalize the container setupTokens(container, containerID); return container; }
protected Credentials parseCredentials( ApplicationSubmissionContext application) throws IOException { Credentials credentials = new Credentials(); DataInputByteBuffer dibb = new DataInputByteBuffer(); ByteBuffer tokens = application.getAMContainerSpec().getTokens(); if (tokens != null) { dibb.reset(tokens); credentials.readTokenStorageStream(dibb); tokens.rewind(); } return credentials; }
protected Credentials parseCredentials() throws IOException { Credentials credentials = new Credentials(); DataInputByteBuffer dibb = new DataInputByteBuffer(); ByteBuffer tokens = submissionContext.getAMContainerSpec().getTokens(); if (tokens != null) { dibb.reset(tokens); credentials.readTokenStorageStream(dibb); tokens.rewind(); } return credentials; } }
protected Credentials parseCredentials( ApplicationSubmissionContext application) throws IOException { Credentials credentials = new Credentials(); DataInputByteBuffer dibb = new DataInputByteBuffer(); ByteBuffer tokens = application.getAMContainerSpec().getTokens(); if (tokens != null) { dibb.reset(tokens); credentials.readTokenStorageStream(dibb); tokens.rewind(); } return credentials; }
protected Credentials parseCredentials() throws IOException { Credentials credentials = new Credentials(); DataInputByteBuffer dibb = new DataInputByteBuffer(); ByteBuffer tokens = submissionContext.getAMContainerSpec().getTokens(); if (tokens != null) { dibb.reset(tokens); credentials.readTokenStorageStream(dibb); tokens.rewind(); } return credentials; } }
ByteBuffer tokens = appContext.getAMContainerSpec().getTokens();
private void sendATSCreateEvent() { rmContext.getRMApplicationHistoryWriter().applicationStarted(this); rmContext.getSystemMetricsPublisher().appCreated(this, this.startTime); String appViewACLs = submissionContext.getAMContainerSpec() .getApplicationACLs().get(ApplicationAccessType.VIEW_APP); rmContext.getSystemMetricsPublisher().appACLsUpdated( this, appViewACLs, systemClock.getTime()); }
submissionContext.getAMContainerSpec().getApplicationACLs()); String appViewACLs = submissionContext.getAMContainerSpec() .getApplicationACLs().get(ApplicationAccessType.VIEW_APP); rmContext.getSystemMetricsPublisher().appACLsUpdated(
submissionContext.getAMContainerSpec().getApplicationACLs()); String appViewACLs = submissionContext.getAMContainerSpec() .getApplicationACLs().get(ApplicationAccessType.VIEW_APP); rmContext.getSystemMetricsPublisher().appACLsUpdated(
@Test(timeout=20000) public void testAMProfiler() throws Exception { JobConf jobConf = new JobConf(); jobConf.setBoolean(MRJobConfig.MR_AM_PROFILE, true); YARNRunner yarnRunner = new YARNRunner(jobConf); ApplicationSubmissionContext submissionContext = buildSubmitContext(yarnRunner, jobConf); ContainerLaunchContext containerSpec = submissionContext.getAMContainerSpec(); List<String> commands = containerSpec.getCommands(); for(String command : commands) { if (command != null) { if (command.contains(PROFILE_PARAMS)) { return; } } } throw new IllegalStateException("Profiler opts not found!"); }
when(containerLaunchContext.getCommands()) .thenReturn(Collections.singletonList("java -Xmx1024m")); when(appSubmissionContext.getAMContainerSpec()) .thenReturn(containerLaunchContext);
app.getApplicationSubmissionContext().getAMContainerSpec(); entityInfo.put(ApplicationMetricsConstants.AM_CONTAINER_LAUNCH_COMMAND, amContainerSpec.getCommands());
private void verifyRMAppFieldsForFinalTransitions(RMApp application) { assertEquals(null, application.getApplicationSubmissionContext(). getAMContainerSpec()); assertEquals(null, application.getApplicationSubmissionContext(). getLogAggregationContext()); } }
@Test public void testRMAppSubmitWithInvalidTokens() throws Exception { // Setup invalid security tokens DataOutputBuffer dob = new DataOutputBuffer(); ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); Configuration conf = new Configuration(); conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); UserGroupInformation.setConfiguration(conf); asContext.getAMContainerSpec().setTokens(securityTokens); try { appMonitor.submitApplication(asContext, "test"); Assert.fail("Application submission should fail because" + " Tokens are invalid."); } catch (YarnException e) { // Exception is expected assertTrue("The thrown exception is not" + " java.io.EOFException", e.getMessage().contains("java.io.EOFException")); } int timeoutSecs = 0; while ((getAppEventType() == RMAppEventType.KILL) && timeoutSecs++ < 20) { Thread.sleep(1000); } Assert.assertEquals("app event type sent is wrong", RMAppEventType.APP_REJECTED, getAppEventType()); asContext.getAMContainerSpec().setTokens(null); }
private void verifyRMAppFieldsForNonFinalTransitions(RMApp application) throws IOException { assertEquals(Arrays.asList("/bin/sleep 5"), application.getApplicationSubmissionContext(). getAMContainerSpec().getCommands()); assertEquals(getLocalResources(), application.getApplicationSubmissionContext(). getAMContainerSpec().getLocalResources()); if(UserGroupInformation.isSecurityEnabled()) { assertEquals(getTokens(), application.getApplicationSubmissionContext(). getAMContainerSpec().getTokens()); assertEquals(getTokensConf(), application.getApplicationSubmissionContext(). getAMContainerSpec().getTokensConf()); } assertEquals(getEnvironment(), application.getApplicationSubmissionContext(). getAMContainerSpec().getEnvironment()); assertEquals(getContainerRetryContext(), application.getApplicationSubmissionContext(). getAMContainerSpec().getContainerRetryContext()); assertEquals(getServiceData(), application.getApplicationSubmissionContext(). getAMContainerSpec().getServiceData()); assertEquals(getLogAggregationContext(), application.getApplicationSubmissionContext(). getLogAggregationContext()); }
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); } }
assertNotNull(ctx.getAMContainerSpec()); assertEquals(17L, ctx.getResource().getMemorySize()); assertEquals("ApplicationSchedulingPropertiesMap should have been pruned"
oldAppSubCtxt.getQueue(), oldAppSubCtxt.getPriority(), oldAppSubCtxt.getAMContainerSpec(), oldAppSubCtxt.getUnmanagedAM(), oldAppSubCtxt.getCancelTokensWhenComplete(),