org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse Java Examples

The following examples show how to use org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse. 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: RMWebServices.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Function that actually creates the ApplicationId by calling the
 * ClientRMService
 * 
 * @return returns structure containing the app-id and maximum resource
 *         capabilities
 */
private NewApplication createNewApplication() {
  GetNewApplicationRequest req =
      recordFactory.newRecordInstance(GetNewApplicationRequest.class);
  GetNewApplicationResponse resp;
  try {
    resp = rm.getClientRMService().getNewApplication(req);
  } catch (YarnException e) {
    String msg = "Unable to create new app from RM web service";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
  NewApplication appId =
      new NewApplication(resp.getApplicationId().toString(),
        new ResourceInfo(resp.getMaximumResourceCapability()));
  return appId;
}
 
Example #2
Source File: GobblinYarnAppLauncher.java    From incubator-gobblin with Apache License 2.0 6 votes vote down vote up
private Resource prepareContainerResource(GetNewApplicationResponse newApplicationResponse) {
  int memoryMbs = this.appMasterMemoryMbs;
  int maximumMemoryCapacity = newApplicationResponse.getMaximumResourceCapability().getMemory();
  if (memoryMbs > maximumMemoryCapacity) {
    LOGGER.info(String.format("Specified AM memory [%d] is above the maximum memory capacity [%d] of the "
        + "cluster, using the maximum memory capacity instead.", memoryMbs, maximumMemoryCapacity));
    memoryMbs = maximumMemoryCapacity;
  }

  int vCores = this.config.getInt(GobblinYarnConfigurationKeys.APP_MASTER_CORES_KEY);
  int maximumVirtualCoreCapacity = newApplicationResponse.getMaximumResourceCapability().getVirtualCores();
  if (vCores > maximumVirtualCoreCapacity) {
    LOGGER.info(String.format("Specified AM vcores [%d] is above the maximum vcore capacity [%d] of the "
        + "cluster, using the maximum vcore capacity instead.", memoryMbs, maximumMemoryCapacity));
    vCores = maximumVirtualCoreCapacity;
  }

  // Set up resource type requirements for ApplicationMaster
  return Resource.newInstance(memoryMbs, vCores);
}
 
Example #3
Source File: Application.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public Application(String user, String queue, ResourceManager resourceManager) 
    throws YarnException {
  this.user = user;
  this.queue = queue;
  this.resourceManager = resourceManager;
  // register an application
  GetNewApplicationRequest request =
          Records.newRecord(GetNewApplicationRequest.class);
  GetNewApplicationResponse newApp = 
      this.resourceManager.getClientRMService().getNewApplication(request);
  this.applicationId = newApp.getApplicationId();

  this.applicationAttemptId =
      ApplicationAttemptId.newInstance(this.applicationId,
        this.numAttempts.getAndIncrement());
}
 
Example #4
Source File: Application.java    From big-c with Apache License 2.0 6 votes vote down vote up
public Application(String user, String queue, ResourceManager resourceManager) 
    throws YarnException {
  this.user = user;
  this.queue = queue;
  this.resourceManager = resourceManager;
  // register an application
  GetNewApplicationRequest request =
          Records.newRecord(GetNewApplicationRequest.class);
  GetNewApplicationResponse newApp = 
      this.resourceManager.getClientRMService().getNewApplication(request);
  this.applicationId = newApp.getApplicationId();

  this.applicationAttemptId =
      ApplicationAttemptId.newInstance(this.applicationId,
        this.numAttempts.getAndIncrement());
}
 
Example #5
Source File: RMWebServices.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Function that actually creates the ApplicationId by calling the
 * ClientRMService
 * 
 * @return returns structure containing the app-id and maximum resource
 *         capabilities
 */
private NewApplication createNewApplication() {
  GetNewApplicationRequest req =
      recordFactory.newRecordInstance(GetNewApplicationRequest.class);
  GetNewApplicationResponse resp;
  try {
    resp = rm.getClientRMService().getNewApplication(req);
  } catch (YarnException e) {
    String msg = "Unable to create new app from RM web service";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
  NewApplication appId =
      new NewApplication(resp.getApplicationId().toString(),
        new ResourceInfo(resp.getMaximumResourceCapability()));
  return appId;
}
 
Example #6
Source File: LocalClient.java    From tez with 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 #7
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws YarnException,
    IOException {
  GetNewApplicationRequestProto requestProto =
      ((GetNewApplicationRequestPBImpl) request).getProto();
  try {
    return new GetNewApplicationResponsePBImpl(proxy.getNewApplication(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #8
Source File: ProtocolHATestBase.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws YarnException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // create the GetNewApplicationResponse with fake applicationId
  GetNewApplicationResponse response =
      GetNewApplicationResponse.newInstance(
          createFakeAppId(), null, null);
  return response;
}
 
Example #9
Source File: YarnClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public YarnClientApplication createApplication()
    throws YarnException, IOException {
  ApplicationSubmissionContext context = Records.newRecord
      (ApplicationSubmissionContext.class);
  GetNewApplicationResponse newApp = getNewApplication();
  ApplicationId appId = newApp.getApplicationId();
  context.setApplicationId(appId);
  return new YarnClientApplication(newApp, context);
}
 
Example #10
Source File: TestRM.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetNewAppId() throws Exception {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  MockRM rm = new MockRM(conf);
  rm.start();
  
  GetNewApplicationResponse resp = rm.getNewAppId();
  assert (resp.getApplicationId().getId() != 0);    
  assert (resp.getMaximumResourceCapability().getMemory() > 0);    
  rm.stop();
}
 
Example #11
Source File: ClientRMService.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws YarnException {
  GetNewApplicationResponse response = recordFactory
      .newRecordInstance(GetNewApplicationResponse.class);
  response.setApplicationId(getNewApplicationId());
  // Pick up min/max resource from scheduler...
  response.setMaximumResourceCapability(scheduler
      .getMaximumResourceCapability());       
  
  return response;
}
 
Example #12
Source File: ApplicationClientProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws YarnException,
    IOException {
  GetNewApplicationRequestProto requestProto =
      ((GetNewApplicationRequestPBImpl) request).getProto();
  try {
    return new GetNewApplicationResponsePBImpl(proxy.getNewApplication(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #13
Source File: Hadoop21YarnAppClient.java    From twill with Apache License 2.0 5 votes vote down vote up
private Resource adjustMemory(GetNewApplicationResponse response, Resource capability) {
  int maxMemory = response.getMaximumResourceCapability().getMemory();
  int updatedMemory = capability.getMemory();

  if (updatedMemory > maxMemory) {
    capability.setMemory(maxMemory);
  }

  return capability;
}
 
Example #14
Source File: ClientRMService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws YarnException {
  GetNewApplicationResponse response = recordFactory
      .newRecordInstance(GetNewApplicationResponse.class);
  response.setApplicationId(getNewApplicationId());
  // Pick up min/max resource from scheduler...
  response.setMaximumResourceCapability(scheduler
      .getMaximumResourceCapability());       
  
  return response;
}
 
Example #15
Source File: ProtocolHATestBase.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws YarnException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // create the GetNewApplicationResponse with fake applicationId
  GetNewApplicationResponse response =
      GetNewApplicationResponse.newInstance(
          createFakeAppId(), null, null);
  return response;
}
 
Example #16
Source File: YarnClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public YarnClientApplication createApplication()
    throws YarnException, IOException {
  ApplicationSubmissionContext context = Records.newRecord
      (ApplicationSubmissionContext.class);
  GetNewApplicationResponse newApp = getNewApplication();
  ApplicationId appId = newApp.getApplicationId();
  context.setApplicationId(appId);
  return new YarnClientApplication(newApp, context);
}
 
Example #17
Source File: TestRM.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetNewAppId() throws Exception {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  MockRM rm = new MockRM(conf);
  rm.start();
  
  GetNewApplicationResponse resp = rm.getNewAppId();
  assert (resp.getApplicationId().getId() != 0);    
  assert (resp.getMaximumResourceCapability().getMemory() > 0);    
  rm.stop();
}
 
Example #18
Source File: YarnClientImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private GetNewApplicationResponse getNewApplication()
    throws YarnException, IOException {
  GetNewApplicationRequest request =
      Records.newRecord(GetNewApplicationRequest.class);
  return rmClient.getNewApplication(request);
}
 
Example #19
Source File: Client.java    From Scribengin with GNU Affero General Public License v3.0 4 votes vote down vote up
public ApplicationId run() throws IOException, YarnException {
  LOG.info("calling run.");
  yarnClient.start();

  // YarnClientApplication is used to populate:
  //   1. GetNewApplication Response
  //   2. ApplicationSubmissionContext
  YarnClientApplication app = yarnClient.createApplication();
  
  // GetNewApplicationResponse can be used to determined resources available.
  GetNewApplicationResponse appResponse = app.getNewApplicationResponse();
  
  ApplicationSubmissionContext appContext = app.getApplicationSubmissionContext();
  this.appId = appContext.getApplicationId();
  appContext.setApplicationName(this.appname);

  // Set up the container launch context for AM.
  ContainerLaunchContext amContainer = Records.newRecord(ContainerLaunchContext.class);

  LocalResource appMasterJar;
  FileSystem fs = FileSystem.get(this.conf);
  
  amContainer.setLocalResources(
      Collections.singletonMap("master.jar",
          Util.newYarnAppResource(fs, new Path(this.hdfsJar), LocalResourceType.FILE,
              LocalResourceVisibility.APPLICATION)));
  // Set up CLASSPATH for ApplicationMaster
  Map<String, String> appMasterEnv = new HashMap<String, String>();
  setupAppMasterEnv(appMasterEnv);
  amContainer.setEnvironment(appMasterEnv);

  // Set up resource requirements for ApplicationMaster
  Resource capability = Records.newRecord(Resource.class);
  capability.setMemory(this.applicationMasterMem);
  capability.setVirtualCores(1); //TODO: Can we really setVirtualCores ?
  amContainer.setCommands(Collections.singletonList(this.getAppMasterCommand()));

  // put everything together.
  appContext.setAMContainerSpec(amContainer);
  appContext.setResource(capability);
  appContext.setQueue("default"); // TODO: Need to investigate more on queuing an scheduling.

  // Submit application
  yarnClient.submitApplication(appContext);
  LOG.info("APPID: "+this.appId.toString());
  return this.appId;
  //return this.monitorApplication(appId);
}
 
Example #20
Source File: MyClient.java    From yarn-beginners-examples with Apache License 2.0 4 votes vote down vote up
/**
 * Main run function for the client
 * @return true if application completed successfully
 * @throws java.io.IOException
 * @throws org.apache.hadoop.yarn.exceptions.YarnException
 */
public boolean run() throws IOException, YarnException {

  LOG.info("Running Client");
  yarnClient.start();

  // Get a new application id
  YarnClientApplication app = yarnClient.createApplication();
  GetNewApplicationResponse appResponse = app.getNewApplicationResponse();

  int maxMem = appResponse.getMaximumResourceCapability().getMemory();
  LOG.info("Max mem capabililty of resources in this cluster " + maxMem);

  // A resource ask cannot exceed the max.
  if (amMemory > maxMem) {
    LOG.info("AM memory specified above max threshold of cluster. Using max value."
        + ", specified=" + amMemory
        + ", max=" + maxMem);
    amMemory = maxMem;
  }

  int maxVCores = appResponse.getMaximumResourceCapability().getVirtualCores();
  LOG.info("Max virtual cores capabililty of resources in this cluster " + maxVCores);

  if (amVCores > maxVCores) {
    LOG.info("AM virtual cores specified above max threshold of cluster. "
        + "Using max value." + ", specified=" + amVCores
        + ", max=" + maxVCores);
    amVCores = maxVCores;
  }

  // set the application name
  ApplicationSubmissionContext appContext = app.getApplicationSubmissionContext();
  ApplicationId appId = appContext.getApplicationId();

  appContext.setApplicationName(appName);

  // Set up resource type requirements
  // For now, both memory and vcores are supported, so we set memory and
  // vcores requirements
  Resource capability = Records.newRecord(Resource.class);
  capability.setMemory(amMemory);
  capability.setVirtualCores(amVCores);
  appContext.setResource(capability);

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

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

  // Set the ContainerLaunchContext to describe the Container ith which the ApplicationMaster is launched.
  appContext.setAMContainerSpec(getAMContainerSpec(appId.getId()));

  // Submit the application to the applications manager
  // SubmitApplicationResponse submitResp = applicationsManager.submitApplication(appRequest);
  // Ignore the response as either a valid response object is returned on success
  // or an exception thrown to denote some form of a failure
  LOG.info("Submitting application to ASM");

  yarnClient.submitApplication(appContext);

  // Monitor the application
  return monitorApplication(appId);
}
 
Example #21
Source File: GobblinYarnAppLauncher.java    From incubator-gobblin with Apache License 2.0 4 votes vote down vote up
/**
 * Setup and submit the Gobblin Yarn application.
 *
 * @throws IOException if there's anything wrong setting up and submitting the Yarn application
 * @throws YarnException if there's anything wrong setting up and submitting the Yarn application
 */
@VisibleForTesting
ApplicationId setupAndSubmitApplication() throws IOException, YarnException {
  YarnClientApplication gobblinYarnApp = this.yarnClient.createApplication();
  ApplicationSubmissionContext appSubmissionContext = gobblinYarnApp.getApplicationSubmissionContext();
  appSubmissionContext.setApplicationType(GOBBLIN_YARN_APPLICATION_TYPE);
  appSubmissionContext.setMaxAppAttempts(ConfigUtils.getInt(config, GobblinYarnConfigurationKeys.APP_MASTER_MAX_ATTEMPTS_KEY, GobblinYarnConfigurationKeys.DEFAULT_APP_MASTER_MAX_ATTEMPTS_KEY));
  ApplicationId applicationId = appSubmissionContext.getApplicationId();

  GetNewApplicationResponse newApplicationResponse = gobblinYarnApp.getNewApplicationResponse();
  // Set up resource type requirements for ApplicationMaster
  Resource resource = prepareContainerResource(newApplicationResponse);

  // Add lib jars, and jars and files that the ApplicationMaster need as LocalResources
  Map<String, LocalResource> appMasterLocalResources = addAppMasterLocalResources(applicationId);

  ContainerLaunchContext amContainerLaunchContext = Records.newRecord(ContainerLaunchContext.class);
  amContainerLaunchContext.setLocalResources(appMasterLocalResources);
  amContainerLaunchContext.setEnvironment(YarnHelixUtils.getEnvironmentVariables(this.yarnConfiguration));
  amContainerLaunchContext.setCommands(Lists.newArrayList(buildApplicationMasterCommand(applicationId.toString(), resource.getMemory())));

  Map<ApplicationAccessType, String> acls = new HashMap<>(1);
  acls.put(ApplicationAccessType.VIEW_APP, this.appViewAcl);
  amContainerLaunchContext.setApplicationACLs(acls);

  if (UserGroupInformation.isSecurityEnabled()) {
    setupSecurityTokens(amContainerLaunchContext);
  }

  // Setup the application submission context
  appSubmissionContext.setApplicationName(this.applicationName);
  appSubmissionContext.setResource(resource);
  appSubmissionContext.setQueue(this.appQueueName);
  appSubmissionContext.setPriority(Priority.newInstance(0));
  appSubmissionContext.setAMContainerSpec(amContainerLaunchContext);
  // Also setup container local resources by copying local jars and files the container need to HDFS
  addContainerLocalResources(applicationId);

  // Submit the application
  LOGGER.info("Submitting application " + sanitizeApplicationId(applicationId.toString()));
  this.yarnClient.submitApplication(appSubmissionContext);

  LOGGER.info("Application successfully submitted and accepted");
  ApplicationReport applicationReport = this.yarnClient.getApplicationReport(applicationId);
  LOGGER.info("Application Name: " + applicationReport.getName());
  LOGGER.info("Application Tracking URL: " + applicationReport.getTrackingUrl());
  LOGGER.info("Application User: " + applicationReport.getUser() + " Queue: " + applicationReport.getQueue());

  return applicationId;
}
 
Example #22
Source File: AMSimulator.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void submitApp()
        throws YarnException, InterruptedException, IOException {
  // ask for new application
  GetNewApplicationRequest newAppRequest =
      Records.newRecord(GetNewApplicationRequest.class);
  GetNewApplicationResponse newAppResponse = 
      rm.getClientRMService().getNewApplication(newAppRequest);
  appId = newAppResponse.getApplicationId();
  
  // submit the application
  final SubmitApplicationRequest subAppRequest =
      Records.newRecord(SubmitApplicationRequest.class);
  ApplicationSubmissionContext appSubContext = 
      Records.newRecord(ApplicationSubmissionContext.class);
  appSubContext.setApplicationId(appId);
  appSubContext.setMaxAppAttempts(1);
  appSubContext.setQueue(queue);
  appSubContext.setPriority(Priority.newInstance(0));
  ContainerLaunchContext conLauContext = 
      Records.newRecord(ContainerLaunchContext.class);
  conLauContext.setApplicationACLs(
      new HashMap<ApplicationAccessType, String>());
  conLauContext.setCommands(new ArrayList<String>());
  conLauContext.setEnvironment(new HashMap<String, String>());
  conLauContext.setLocalResources(new HashMap<String, LocalResource>());
  conLauContext.setServiceData(new HashMap<String, ByteBuffer>());
  appSubContext.setAMContainerSpec(conLauContext);
  appSubContext.setUnmanagedAM(true);
  subAppRequest.setApplicationSubmissionContext(appSubContext);
  UserGroupInformation ugi = UserGroupInformation.createRemoteUser(user);
  ugi.doAs(new PrivilegedExceptionAction<Object>() {
    @Override
    public Object run() throws YarnException {
      rm.getClientRMService().submitApplication(subAppRequest);
      return null;
    }
  });
  LOG.info(MessageFormat.format("Submit a new application {0}", appId));
  
  // waiting until application ACCEPTED
  RMApp app = rm.getRMContext().getRMApps().get(appId);
  while(app.getState() != RMAppState.ACCEPTED) {
    Thread.sleep(10);
  }

  // Waiting until application attempt reach LAUNCHED
  // "Unmanaged AM must register after AM attempt reaches LAUNCHED state"
  this.appAttemptId = rm.getRMContext().getRMApps().get(appId)
      .getCurrentAppAttempt().getAppAttemptId();
  RMAppAttempt rmAppAttempt = rm.getRMContext().getRMApps().get(appId)
      .getCurrentAppAttempt();
  while (rmAppAttempt.getAppAttemptState() != RMAppAttemptState.LAUNCHED) {
    Thread.sleep(10);
  }
}
 
Example #23
Source File: TestClientRedirect.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws IOException {
  return null;
}
 
Example #24
Source File: TestYARNRunner.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Test(timeout=20000)
public void testResourceMgrDelegate() throws Exception {
  /* we not want a mock of resource mgr delegate */
  final ApplicationClientProtocol clientRMProtocol = mock(ApplicationClientProtocol.class);
  ResourceMgrDelegate delegate = new ResourceMgrDelegate(conf) {
    @Override
    protected void serviceStart() throws Exception {
      assertTrue(this.client instanceof YarnClientImpl);
      ((YarnClientImpl) this.client).setRMClient(clientRMProtocol);
    }
  };
  /* make sure kill calls finish application master */
  when(clientRMProtocol.forceKillApplication(any(KillApplicationRequest.class)))
  .thenReturn(KillApplicationResponse.newInstance(true));
  delegate.killApplication(appId);
  verify(clientRMProtocol).forceKillApplication(any(KillApplicationRequest.class));

  /* make sure getalljobs calls get all applications */
  when(clientRMProtocol.getApplications(any(GetApplicationsRequest.class))).
  thenReturn(recordFactory.newRecordInstance(GetApplicationsResponse.class));
  delegate.getAllJobs();
  verify(clientRMProtocol).getApplications(any(GetApplicationsRequest.class));

  /* make sure getapplication report is called */
  when(clientRMProtocol.getApplicationReport(any(GetApplicationReportRequest.class)))
  .thenReturn(recordFactory.newRecordInstance(GetApplicationReportResponse.class));
  delegate.getApplicationReport(appId);
  verify(clientRMProtocol).getApplicationReport(any(GetApplicationReportRequest.class));

  /* make sure metrics is called */
  GetClusterMetricsResponse clusterMetricsResponse = recordFactory.newRecordInstance
      (GetClusterMetricsResponse.class);
  clusterMetricsResponse.setClusterMetrics(recordFactory.newRecordInstance(
      YarnClusterMetrics.class));
  when(clientRMProtocol.getClusterMetrics(any(GetClusterMetricsRequest.class)))
  .thenReturn(clusterMetricsResponse);
  delegate.getClusterMetrics();
  verify(clientRMProtocol).getClusterMetrics(any(GetClusterMetricsRequest.class));

  when(clientRMProtocol.getClusterNodes(any(GetClusterNodesRequest.class))).
  thenReturn(recordFactory.newRecordInstance(GetClusterNodesResponse.class));
  delegate.getActiveTrackers();
  verify(clientRMProtocol).getClusterNodes(any(GetClusterNodesRequest.class));
  
  GetNewApplicationResponse newAppResponse = recordFactory.newRecordInstance(
      GetNewApplicationResponse.class);
  newAppResponse.setApplicationId(appId);
  when(clientRMProtocol.getNewApplication(any(GetNewApplicationRequest.class))).
  thenReturn(newAppResponse);
  delegate.getNewJobID();
  verify(clientRMProtocol).getNewApplication(any(GetNewApplicationRequest.class));
  
  GetQueueInfoResponse queueInfoResponse = recordFactory.newRecordInstance(
      GetQueueInfoResponse.class);
  queueInfoResponse.setQueueInfo(recordFactory.newRecordInstance(QueueInfo.class));
  when(clientRMProtocol.getQueueInfo(any(GetQueueInfoRequest.class))).
  thenReturn(queueInfoResponse);
  delegate.getQueues();
  verify(clientRMProtocol).getQueueInfo(any(GetQueueInfoRequest.class));

  GetQueueUserAclsInfoResponse aclResponse = recordFactory.newRecordInstance(
      GetQueueUserAclsInfoResponse.class);
  when(clientRMProtocol.getQueueUserAcls(any(GetQueueUserAclsInfoRequest.class)))
  .thenReturn(aclResponse);
  delegate.getQueueAclsForCurrentUser();
  verify(clientRMProtocol).getQueueUserAcls(any(GetQueueUserAclsInfoRequest.class));
}
 
Example #25
Source File: MockRM.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public GetNewApplicationResponse getNewAppId() throws Exception {
  ApplicationClientProtocol client = getClientRMService();
  return client.getNewApplication(Records
      .newRecord(GetNewApplicationRequest.class));
}
 
Example #26
Source File: YarnClientApplication.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public YarnClientApplication(GetNewApplicationResponse newAppResponse,
                             ApplicationSubmissionContext appContext) {
  this.newAppResponse = newAppResponse;
  this.appSubmissionContext = appContext;
}
 
Example #27
Source File: TestClientRedirect.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public GetNewApplicationResponse getNewApplication(
    GetNewApplicationRequest request) throws IOException {
  return null;
}
 
Example #28
Source File: YarnClientApplication.java    From big-c with Apache License 2.0 4 votes vote down vote up
public GetNewApplicationResponse getNewApplicationResponse() {
  return newAppResponse;
}
 
Example #29
Source File: YarnClientApplication.java    From big-c with Apache License 2.0 4 votes vote down vote up
public YarnClientApplication(GetNewApplicationResponse newAppResponse,
                             ApplicationSubmissionContext appContext) {
  this.newAppResponse = newAppResponse;
  this.appSubmissionContext = appContext;
}
 
Example #30
Source File: YarnClientApplication.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public GetNewApplicationResponse getNewApplicationResponse() {
  return newAppResponse;
}