Java Code Examples for org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext

The following examples show how to use org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext. These examples are extracted from open source projects. 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 Project: tez   Source File: TestTezClientUtils.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeout = 2000)
// this test checks if the priority field is set properly in the
// ApplicationSubmissionContext
public void testAppSubmissionContextForPriority() throws Exception {
  TezConfiguration tezConf = new TezConfiguration();
  tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, STAGING_DIR.getAbsolutePath());
  int testpriority = 999;
  ApplicationId appId = ApplicationId.newInstance(1000, 1);
  Credentials credentials = new Credentials();
  TezClientUtils.createSessionToken(appId.toString(),
      new JobTokenSecretManager(), credentials);
  tezConf.setBoolean(TezConfiguration.TEZ_IGNORE_LIB_URIS, true);
  Map<String, LocalResource> m = new HashMap<String, LocalResource>();
  tezConf.setInt(TezConfiguration.TEZ_AM_APPLICATION_PRIORITY, testpriority);
  AMConfiguration amConf =
      new AMConfiguration(tezConf, new HashMap<String, LocalResource>(), credentials);
  ApplicationSubmissionContext appcontext;
  appcontext = TezClientUtils.createApplicationSubmissionContext(
      appId, null, "dagname",
      amConf, m,
      credentials, false,
      new TezApiVersionInfo(), null, null);
  assertEquals(testpriority, appcontext.getPriority().getPriority());
}
 
Example 2
private void setApplicationTags(final ApplicationSubmissionContext appContext) throws InvocationTargetException,
	IllegalAccessException {

	final ApplicationSubmissionContextReflector reflector = ApplicationSubmissionContextReflector.getInstance();
	final String tagsString = flinkConfiguration.getString(YarnConfigOptions.APPLICATION_TAGS);

	final Set<String> applicationTags = new HashSet<>();

	// Trim whitespace and cull empty tags
	for (final String tag : tagsString.split(",")) {
		final String trimmedTag = tag.trim();
		if (!trimmedTag.isEmpty()) {
			applicationTags.add(trimmedTag);
		}
	}

	reflector.setApplicationTags(appContext, applicationTags);
}
 
Example 3
Source Project: flink   Source File: AbstractYarnClusterDescriptor.java    License: Apache License 2.0 6 votes vote down vote up
private void setApplicationTags(final ApplicationSubmissionContext appContext) throws InvocationTargetException,
	IllegalAccessException {

	final ApplicationSubmissionContextReflector reflector = ApplicationSubmissionContextReflector.getInstance();
	final String tagsString = flinkConfiguration.getString(YarnConfigOptions.APPLICATION_TAGS);

	final Set<String> applicationTags = new HashSet<>();

	// Trim whitespace and cull empty tags
	for (final String tag : tagsString.split(",")) {
		final String trimmedTag = tag.trim();
		if (!trimmedTag.isEmpty()) {
			applicationTags.add(trimmedTag);
		}
	}

	reflector.setApplicationTags(appContext, applicationTags);
}
 
Example 4
Source Project: hadoop   Source File: AMLauncher.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 5
Source Project: hadoop   Source File: RMAppAttemptImpl.java    License: Apache License 2.0 6 votes vote down vote up
public RMAppAttemptImpl(ApplicationAttemptId appAttemptId,
    RMContext rmContext, YarnScheduler scheduler,
    ApplicationMasterService masterService,
    ApplicationSubmissionContext submissionContext,
    Configuration conf, boolean maybeLastAttempt, ResourceRequest amReq) {
  this.conf = conf;
  this.applicationAttemptId = appAttemptId;
  this.rmContext = rmContext;
  this.eventHandler = rmContext.getDispatcher().getEventHandler();
  this.submissionContext = submissionContext;
  this.scheduler = scheduler;
  this.masterService = masterService;

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

  this.proxiedTrackingUrl = generateProxyUriWithScheme();
  this.maybeLastAttempt = maybeLastAttempt;
  this.stateMachine = stateMachineFactory.make(this);

  this.attemptMetrics =
      new RMAppAttemptMetrics(applicationAttemptId, rmContext);
  
  this.amReq = amReq;
}
 
Example 6
Source Project: flink   Source File: YarnClusterDescriptor.java    License: Apache License 2.0 6 votes vote down vote up
private void setApplicationTags(final ApplicationSubmissionContext appContext) throws InvocationTargetException,
		IllegalAccessException {

	final ApplicationSubmissionContextReflector reflector = ApplicationSubmissionContextReflector.getInstance();
	final String tagsString = flinkConfiguration.getString(YarnConfigOptions.APPLICATION_TAGS);

	final Set<String> applicationTags = new HashSet<>();

	// Trim whitespace and cull empty tags
	for (final String tag : tagsString.split(",")) {
		final String trimmedTag = tag.trim();
		if (!trimmedTag.isEmpty()) {
			applicationTags.add(trimmedTag);
		}
	}

	reflector.setApplicationTags(appContext, applicationTags);
}
 
Example 7
Source Project: big-c   Source File: RMHATestBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void submitApplication(
    ApplicationSubmissionContext submissionContext, long submitTime,
    String user) throws YarnException {
  //Do nothing, just add the application to RMContext
  RMAppImpl application =
      new RMAppImpl(submissionContext.getApplicationId(), this.rmContext,
          this.conf, submissionContext.getApplicationName(), user,
          submissionContext.getQueue(), submissionContext,
          this.rmContext.getScheduler(),
          this.rmContext.getApplicationMasterService(),
          submitTime, submissionContext.getApplicationType(),
          submissionContext.getApplicationTags(), null);
  this.rmContext.getRMApps().put(submissionContext.getApplicationId(),
      application);
  //Do not send RMAppEventType.START event
  //so the state of Application will not reach to NEW_SAVING state.
}
 
Example 8
Source Project: big-c   Source File: SchedulerApplicationAttempt.java    License: Apache License 2.0 6 votes vote down vote up
public SchedulerApplicationAttempt(ApplicationAttemptId applicationAttemptId, 
    String user, Queue queue, ActiveUsersManager activeUsersManager,
    RMContext rmContext) {
  Preconditions.checkNotNull(rmContext, "RMContext should not be null");
  this.rmContext = rmContext;
  this.appSchedulingInfo = 
      new AppSchedulingInfo(applicationAttemptId, user, queue,  
          activeUsersManager, rmContext.getEpoch());
  this.queue = queue;
  this.pendingRelease = new HashSet<ContainerId>();
  this.attemptId = applicationAttemptId;
  if (rmContext.getRMApps() != null &&
      rmContext.getRMApps()
          .containsKey(applicationAttemptId.getApplicationId())) {
    ApplicationSubmissionContext appSubmissionContext =
        rmContext.getRMApps().get(applicationAttemptId.getApplicationId())
            .getApplicationSubmissionContext();
    if (appSubmissionContext != null) {
      unmanagedAM = appSubmissionContext.getUnmanagedAM();
      this.logAggregationContext =
          appSubmissionContext.getLogAggregationContext();
    }
  }
}
 
Example 9
Source Project: big-c   Source File: TestAppManager.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Before
public void setUp() {
  long now = System.currentTimeMillis();

  rmContext = mockRMContext(1, now - 10);
  ResourceScheduler scheduler = mockResourceScheduler();
  Configuration conf = new Configuration();
  ApplicationMasterService masterService =
      new ApplicationMasterService(rmContext, scheduler);
  appMonitor = new TestRMAppManager(rmContext,
      new ClientToAMTokenSecretManagerInRM(), scheduler, masterService,
      new ApplicationACLsManager(conf), conf);

  appId = MockApps.newAppID(1);
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  asContext =
      recordFactory.newRecordInstance(ApplicationSubmissionContext.class);
  asContext.setApplicationId(appId);
  asContext.setAMContainerSpec(mockContainerLaunchContext(recordFactory));
  asContext.setResource(mockResource());
  setupDispatcher(rmContext, conf);
}
 
Example 10
Source Project: big-c   Source File: BuilderUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static ApplicationSubmissionContext newApplicationSubmissionContext(
    ApplicationId applicationId, String applicationName, String queue,
    Priority priority, ContainerLaunchContext amContainer,
    boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
    int maxAppAttempts, Resource resource, String applicationType) {
  ApplicationSubmissionContext context =
      recordFactory.newRecordInstance(ApplicationSubmissionContext.class);
  context.setApplicationId(applicationId);
  context.setApplicationName(applicationName);
  context.setQueue(queue);
  context.setPriority(priority);
  context.setAMContainerSpec(amContainer);
  context.setUnmanagedAM(isUnmanagedAM);
  context.setCancelTokensWhenComplete(cancelTokensWhenComplete);
  context.setMaxAppAttempts(maxAppAttempts);
  context.setResource(resource);
  context.setApplicationType(applicationType);
  return context;
}
 
Example 11
Source Project: tez   Source File: TezClientUtils.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
// this method will set the app priority only if the priority config has been defined
public static void setApplicationPriority(ApplicationSubmissionContext context,
    AMConfiguration amConfig) {
  if (amConfig.getTezConfiguration().get(TezConfiguration.TEZ_AM_APPLICATION_PRIORITY) != null) {
    // since we already checked not null condition, we are guaranteed that default value
    // (0 in this case for getInt) will not be returned/used.
    // The idea is to not use any default priority from TEZ side, if none provided in config;
    // let YARN determine the priority of the submitted application
    int priority = amConfig.getTezConfiguration().getInt(TezConfiguration.TEZ_AM_APPLICATION_PRIORITY, 0);
    context.setPriority(Priority.newInstance(priority));
    if (LOG.isDebugEnabled()) {
      LOG.debug("Settting TEZ application priority, applicationId= " + context.getApplicationId() +
          ", priority= " + context.getPriority().getPriority());
    }
  }
}
 
Example 12
Source Project: hadoop   Source File: TestRMAppTransitions.java    License: Apache License 2.0 6 votes vote down vote up
protected RMApp testCreateAppFinished(
    ApplicationSubmissionContext submissionContext,
    String diagnostics) throws IOException {
  // unmanaged AMs don't use the FINISHING state
  RMApp application = null;
  if (submissionContext != null && submissionContext.getUnmanagedAM()) {
    application = testCreateAppRunning(submissionContext);
  } else {
    application = testCreateAppFinishing(submissionContext);
  }
  // RUNNING/FINISHING => FINISHED event RMAppEventType.ATTEMPT_FINISHED
  RMAppEvent finishedEvent = new RMAppFinishedAttemptEvent(
      application.getApplicationId(), diagnostics);
  application.handle(finishedEvent);
  assertAppState(RMAppState.FINISHED, application);
  assertTimesAtFinish(application);
  // finished without a proper unregister implies failed
  assertFinalAppStatus(FinalApplicationStatus.FAILED, application);
  Assert.assertTrue("Finished app missing diagnostics",
      application.getDiagnostics().indexOf(diagnostics) != -1);
  return application;
}
 
Example 13
Source Project: tez   Source File: TezClient.java    License: Apache License 2.0 6 votes vote down vote up
private ApplicationSubmissionContext setupApplicationContext() throws IOException, YarnException {
  TezClientUtils.processTezLocalCredentialsFile(sessionCredentials,
          amConfig.getTezConfiguration());

  Map<String, LocalResource> tezJarResources = getTezJarResources(sessionCredentials);
  // Add session token for shuffle
  TezClientUtils.createSessionToken(sessionAppId.toString(),
          jobTokenSecretManager, sessionCredentials);

  ApplicationSubmissionContext appContext =
          TezClientUtils.createApplicationSubmissionContext(
                  sessionAppId,
                  null, clientName, amConfig,
                  tezJarResources, sessionCredentials, usingTezArchiveDeploy, apiVersionInfo,
                  servicePluginsDescriptor, javaOptsChecker);

  // Set Tez Sessions to not retry on AM crashes if recovery is disabled
  if (!amConfig.getTezConfiguration().getBoolean(
          TezConfiguration.DAG_RECOVERY_ENABLED,
          TezConfiguration.DAG_RECOVERY_ENABLED_DEFAULT)) {
    appContext.setMaxAppAttempts(1);
  }
  return appContext;
}
 
Example 14
Source Project: hadoop   Source File: TestYARNRunner.java    License: Apache License 2.0 6 votes vote down vote up
@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!");
}
 
Example 15
Source Project: hadoop   Source File: RMStateStoreTestBase.java    License: Apache License 2.0 6 votes vote down vote up
protected RMApp storeApp(RMStateStore store, ApplicationId appId,
    long submitTime,
    long startTime) throws Exception {
  ApplicationSubmissionContext context =
      new ApplicationSubmissionContextPBImpl();
  context.setApplicationId(appId);

  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");
  store.storeNewApplication(mockApp);
  return mockApp;
}
 
Example 16
Source Project: tez   Source File: LocalClient.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public YarnClientApplication createApplication() throws YarnException, IOException {
  ApplicationSubmissionContext context = Records.newRecord(ApplicationSubmissionContext.class);
  ApplicationId appId = ApplicationId.newInstance(clusterTimeStamp, appIdNumber++);
  context.setApplicationId(appId);
  GetNewApplicationResponse response = Records.newRecord(GetNewApplicationResponse.class);
  response.setApplicationId(appId);
  return new YarnClientApplication(response, context);
}
 
Example 17
public void setApplicationTags(
	ApplicationSubmissionContext appContext,
	Set<String> applicationTags) throws InvocationTargetException, IllegalAccessException {
	if (applicationTagsMethod != null) {
		LOG.debug("Calling method {} of {}.",
			applicationTagsMethod.getName(),
			appContext.getClass().getCanonicalName());
		applicationTagsMethod.invoke(appContext, applicationTags);
	} else {
		LOG.debug("{} does not support method {}. Doing nothing.",
			appContext.getClass().getCanonicalName(),
			APPLICATION_TAGS_METHOD_NAME);
	}
}
 
Example 18
public void setApplicationNodeLabel(
	ApplicationSubmissionContext appContext,
	String nodeLabel) throws InvocationTargetException, IllegalAccessException {
	if (nodeLabelExpressionMethod != null) {
		LOG.debug("Calling method {} of {}.",
			nodeLabelExpressionMethod.getName(),
			appContext.getClass().getCanonicalName());
		nodeLabelExpressionMethod.invoke(appContext, nodeLabel);
	} else {
		LOG.debug("{} does not support method {}. Doing nothing.",
			appContext.getClass().getCanonicalName(),
			NODE_LABEL_EXPRESSION_NAME);
	}
}
 
Example 19
public void setAttemptFailuresValidityInterval(
		ApplicationSubmissionContext appContext,
		long validityInterval) throws InvocationTargetException, IllegalAccessException {
	if (attemptFailuresValidityIntervalMethod != null) {
		LOG.debug("Calling method {} of {}.",
			attemptFailuresValidityIntervalMethod.getName(),
			appContext.getClass().getCanonicalName());
		attemptFailuresValidityIntervalMethod.invoke(appContext, validityInterval);
	} else {
		LOG.debug("{} does not support method {}. Doing nothing.",
			appContext.getClass().getCanonicalName(),
			ATTEMPT_FAILURES_METHOD_NAME);
	}
}
 
Example 20
public void setKeepContainersAcrossApplicationAttempts(
	ApplicationSubmissionContext appContext,
	boolean keepContainers) throws InvocationTargetException, IllegalAccessException {

	if (keepContainersMethod != null) {
		LOG.debug("Calling method {} of {}.", keepContainersMethod.getName(),
			appContext.getClass().getCanonicalName());
		keepContainersMethod.invoke(appContext, keepContainers);
	} else {
		LOG.debug("{} does not support method {}. Doing nothing.",
			appContext.getClass().getCanonicalName(), KEEP_CONTAINERS_METHOD_NAME);
	}
}
 
Example 21
Source Project: big-c   Source File: TestRMAppTransitions.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testUnmanagedApp() throws IOException {
  ApplicationSubmissionContext subContext = new ApplicationSubmissionContextPBImpl();
  subContext.setUnmanagedAM(true);

  // test success path
  LOG.info("--- START: testUnmanagedAppSuccessPath ---");
  final String diagMsg = "some diagnostics";
  RMApp application = testCreateAppFinished(subContext, diagMsg);
  Assert.assertTrue("Finished app missing diagnostics",
      application.getDiagnostics().indexOf(diagMsg) != -1);

  // reset the counter of Mockito.verify
  reset(writer);
  reset(publisher);

  // test app fails after 1 app attempt failure
  LOG.info("--- START: testUnmanagedAppFailPath ---");
  application = testCreateAppRunning(subContext);
  RMAppEvent event = new RMAppFailedAttemptEvent(
      application.getApplicationId(), RMAppEventType.ATTEMPT_FAILED, "", false);
  application.handle(event);
  rmDispatcher.await();
  RMAppAttempt appAttempt = application.getCurrentAppAttempt();
  Assert.assertEquals(1, appAttempt.getAppAttemptId().getAttemptId());
  sendAppUpdateSavedEvent(application);
  assertFailed(application,
      ".*Unmanaged application.*Failing the application.*");
  assertAppFinalStateSaved(application);
}
 
Example 22
Source Project: big-c   Source File: TestRMAppTransitions.java    License: Apache License 2.0 5 votes vote down vote up
public void testRecoverApplication(ApplicationStateData appState,
    RMState rmState)
    throws Exception {
  ApplicationSubmissionContext submissionContext =
      appState.getApplicationSubmissionContext();
  RMAppImpl application =
      new RMAppImpl(
          appState.getApplicationSubmissionContext().getApplicationId(),
          rmContext, conf,
          submissionContext.getApplicationName(), null,
          submissionContext.getQueue(), submissionContext, null, null,
          appState.getSubmitTime(), submissionContext.getApplicationType(),
          submissionContext.getApplicationTags(),
          BuilderUtils.newResourceRequest(
              RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
              submissionContext.getResource(), 1));
  Assert.assertEquals(RMAppState.NEW, application.getState());

  RMAppEvent recoverEvent =
      new RMAppRecoverEvent(application.getApplicationId(), rmState);
  // Trigger RECOVER event.
  application.handle(recoverEvent);
  // Application final status looked from recoveredFinalStatus
  Assert.assertTrue("Application is not in recoveredFinalStatus.",
      RMAppImpl.isAppInFinalState(application));

  rmDispatcher.await();
  RMAppState finalState = appState.getState();
  Assert.assertEquals("Application is not in finalState.", finalState,
      application.getState());
}
 
Example 23
Source Project: flink   Source File: AbstractYarnClusterDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
public void setApplicationNodeLabel(
	ApplicationSubmissionContext appContext,
	String nodeLabel) throws InvocationTargetException, IllegalAccessException {
	if (nodeLabelExpressionMethod != null) {
		LOG.debug("Calling method {} of {}.",
			nodeLabelExpressionMethod.getName(),
			appContext.getClass().getCanonicalName());
		nodeLabelExpressionMethod.invoke(appContext, nodeLabel);
	} else {
		LOG.debug("{} does not support method {}. Doing nothing.",
			appContext.getClass().getCanonicalName(),
			NODE_LABEL_EXPRESSION_NAME);
	}
}
 
Example 24
Source Project: big-c   Source File: TestYarnClient.java    License: Apache License 2.0 5 votes vote down vote up
private ApplicationId createApp(YarnClient rmClient, boolean unmanaged) 
  throws Exception {
  YarnClientApplication newApp = rmClient.createApplication();

  ApplicationId appId = newApp.getNewApplicationResponse().getApplicationId();

  // Create launch context for app master
  ApplicationSubmissionContext appContext
    = Records.newRecord(ApplicationSubmissionContext.class);

  // set the application id
  appContext.setApplicationId(appId);

  // set the application name
  appContext.setApplicationName("test");

  // Set the priority for the application master
  Priority pri = Records.newRecord(Priority.class);
  pri.setPriority(1);
  appContext.setPriority(pri);

  // Set the queue to which this application is to be submitted in the RM
  appContext.setQueue("default");

  // Set up the container launch context for the application master
  ContainerLaunchContext amContainer
    = Records.newRecord(ContainerLaunchContext.class);
  appContext.setAMContainerSpec(amContainer);
  appContext.setResource(Resource.newInstance(1024, 1));
  appContext.setUnmanagedAM(unmanaged);

  // Submit the application to the applications manager
  rmClient.submitApplication(appContext);

  return appId;
}
 
Example 25
Source Project: flink   Source File: AbstractYarnClusterDescriptor.java    License: Apache License 2.0 5 votes vote down vote up
public void setKeepContainersAcrossApplicationAttempts(
	ApplicationSubmissionContext appContext,
	boolean keepContainers) throws InvocationTargetException, IllegalAccessException {

	if (keepContainersMethod != null) {
		LOG.debug("Calling method {} of {}.", keepContainersMethod.getName(),
			appContext.getClass().getCanonicalName());
		keepContainersMethod.invoke(appContext, keepContainers);
	} else {
		LOG.debug("{} does not support method {}. Doing nothing.",
			appContext.getClass().getCanonicalName(), KEEP_CONTAINERS_METHOD_NAME);
	}
}
 
Example 26
Source Project: big-c   Source File: AMLauncher.java    License: Apache License 2.0 5 votes vote down vote up
private void launch() throws IOException, YarnException {
  connect();
  ContainerId masterContainerID = masterContainer.getId();
  ApplicationSubmissionContext applicationContext =
    application.getSubmissionContext();
  LOG.info("Setting up container " + masterContainer
      + " for AM " + application.getAppAttemptId());  
  ContainerLaunchContext launchContext =
      createAMContainerLaunchContext(applicationContext, masterContainerID);

  StartContainerRequest scRequest =
      StartContainerRequest.newInstance(launchContext,
        masterContainer.getContainerToken());
  List<StartContainerRequest> list = new ArrayList<StartContainerRequest>();
  list.add(scRequest);
  StartContainersRequest allRequests =
      StartContainersRequest.newInstance(list);

  StartContainersResponse response =
      containerMgrProxy.startContainers(allRequests);
  if (response.getFailedRequests() != null
      && response.getFailedRequests().containsKey(masterContainerID)) {
    Throwable t =
        response.getFailedRequests().get(masterContainerID).deSerialize();
    parseAndThrowException(t);
  } else {
    LOG.info("Done launching container " + masterContainer + " for AM "
        + application.getAppAttemptId());
  }
}
 
Example 27
Source Project: hadoop   Source File: SubmitApplicationRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Public
@Stable
public static SubmitApplicationRequest newInstance(
    ApplicationSubmissionContext context) {
  SubmitApplicationRequest request =
      Records.newRecord(SubmitApplicationRequest.class);
  request.setApplicationSubmissionContext(context);
  return request;
}
 
Example 28
Source Project: big-c   Source File: TestRMAppTransitions.java    License: Apache License 2.0 5 votes vote down vote up
protected RMApp testCreateAppNewSaving(
    ApplicationSubmissionContext submissionContext) throws IOException {
RMApp application = createNewTestApp(submissionContext);
  verify(writer).applicationStarted(any(RMApp.class));
  verify(publisher).appCreated(any(RMApp.class), anyLong());
  // NEW => NEW_SAVING event RMAppEventType.START
  RMAppEvent event = 
      new RMAppEvent(application.getApplicationId(), RMAppEventType.START);
  application.handle(event);
  assertStartTimeSet(application);
  assertAppState(RMAppState.NEW_SAVING, application);
  return application;
}
 
Example 29
Source Project: TensorFlowOnYARN   Source File: LaunchCluster.java    License: Apache License 2.0 5 votes vote down vote up
ApplicationId submitApplication(
    YarnClientApplication app,
    String appName,
    ContainerLaunchContext launchContext,
    Resource resource,
    String queue) throws Exception {
  ApplicationSubmissionContext appContext = app.getApplicationSubmissionContext();
  appContext.setApplicationName(appName);
  appContext.setApplicationTags(new HashSet<>());
  appContext.setAMContainerSpec(launchContext);
  appContext.setResource(resource);
  appContext.setQueue(queue);

  return yarnClient.submitApplication(appContext);
}
 
Example 30
Source Project: hadoop   Source File: SubmitApplicationRequestPBImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ApplicationSubmissionContext getApplicationSubmissionContext() {
  SubmitApplicationRequestProtoOrBuilder p = viaProto ? proto : builder;
  if (this.applicationSubmissionContext != null) {
    return this.applicationSubmissionContext;
  }
  if (!p.hasApplicationSubmissionContext()) {
    return null;
  }
  this.applicationSubmissionContext = convertFromProtoFormat(p.getApplicationSubmissionContext());
  return this.applicationSubmissionContext;
}