当前位置: 首页>>代码示例>>Java>>正文


Java GetNewApplicationResponse.getApplicationId方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse.getApplicationId方法的典型用法代码示例。如果您正苦于以下问题:Java GetNewApplicationResponse.getApplicationId方法的具体用法?Java GetNewApplicationResponse.getApplicationId怎么用?Java GetNewApplicationResponse.getApplicationId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse的用法示例。


在下文中一共展示了GetNewApplicationResponse.getApplicationId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Application

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
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());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:Application.java

示例2: run

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
public boolean run() throws YarnException, IOException {
	yarnClient.start();
	YarnClientApplication client = yarnClient.createApplication();
	GetNewApplicationResponse appResponse = client.getNewApplicationResponse();
	appId = appResponse.getApplicationId();
	LOG.info("Applicatoin ID = {}", appId);
	int maxMemory =	appResponse.getMaximumResourceCapability().getMemory();
	int maxVCores =	appResponse.getMaximumResourceCapability().getVirtualCores();
	LOG.info("Max memory = {} and max vcores = {}", maxMemory, maxVCores);
	YarnClusterMetrics clusterMetrics =
			yarnClient.getYarnClusterMetrics();
	LOG.info("Number of NodeManagers = {}", clusterMetrics.getNumNodeManagers());

	List<NodeReport> nodeReports = yarnClient.getNodeReports(NodeState.RUNNING);
	for (NodeReport node : nodeReports) {
		LOG.info("Node ID = {}, address = {}, containers = {}", node.getNodeId(), node.getHttpAddress(),
				node.getNumContainers());
	}
	List<QueueInfo> queueList = yarnClient.getAllQueues();
	for (QueueInfo queue : queueList) {
		LOG.info("Available queue: {} with capacity {} to {}", queue.getQueueName(), queue.getCapacity(),
				queue.getMaximumCapacity());
	}
	return true;
}
 
开发者ID:HortonworksUniversity,项目名称:YARN_Rev2,代码行数:26,代码来源:AppClient.java

示例3: createApplication

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
@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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:YarnClientImpl.java

示例4: getSeedQueryId

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
@Override
public String getSeedQueryId() throws IOException {
  try {
    GetNewApplicationResponse newApp = yarnClient.getNewApplication();
    ApplicationId appId = newApp.getApplicationId();

    return appId.toString();
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);

    throw new IOException(e.getMessage(), e);
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:14,代码来源:YarnTajoResourceManager.java

示例5: createLauncher

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
@Override
public ProcessLauncher<ApplicationId> createLauncher(TwillSpecification twillSpec) throws Exception {
  // Request for new application
  final GetNewApplicationResponse response = yarnClient.getNewApplication();
  final ApplicationId appId = response.getApplicationId();

  // Setup the context for application submission
  final ApplicationSubmissionContext appSubmissionContext = Records.newRecord(ApplicationSubmissionContext.class);
  appSubmissionContext.setApplicationId(appId);
  appSubmissionContext.setApplicationName(twillSpec.getName());
  appSubmissionContext.setUser(user);

  ApplicationSubmitter submitter = new ApplicationSubmitter() {

    @Override
    public ProcessController<YarnApplicationReport> submit(YarnLaunchContext launchContext, Resource capability) {
      ContainerLaunchContext context = launchContext.getLaunchContext();
      addRMToken(context);
      context.setUser(appSubmissionContext.getUser());
      context.setResource(adjustMemory(response, capability));
      appSubmissionContext.setAMContainerSpec(context);

      try {
        yarnClient.submitApplication(appSubmissionContext);
        return new ProcessControllerImpl(yarnClient, appId);
      } catch (YarnRemoteException e) {
        LOG.error("Failed to submit application {}", appId, e);
        throw Throwables.propagate(e);
      }
    }
  };

  return new ApplicationMasterProcessLauncher(appId, submitter);
}
 
开发者ID:chtyim,项目名称:incubator-twill,代码行数:35,代码来源:Hadoop20YarnAppClient.java

示例6: createLauncher

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
@Override
public ProcessLauncher<ApplicationId> createLauncher(TwillSpecification twillSpec) throws Exception {
  // Request for new application
  YarnClientApplication application = yarnClient.createApplication();
  final GetNewApplicationResponse response = application.getNewApplicationResponse();
  final ApplicationId appId = response.getApplicationId();

  // Setup the context for application submission
  final ApplicationSubmissionContext appSubmissionContext = application.getApplicationSubmissionContext();
  appSubmissionContext.setApplicationId(appId);
  appSubmissionContext.setApplicationName(twillSpec.getName());

  ApplicationSubmitter submitter = new ApplicationSubmitter() {
    @Override
    public ProcessController<YarnApplicationReport> submit(YarnLaunchContext context, Resource capability) {
      ContainerLaunchContext launchContext = context.getLaunchContext();

      addRMToken(launchContext);
      appSubmissionContext.setAMContainerSpec(launchContext);
      appSubmissionContext.setResource(adjustMemory(response, capability));
      appSubmissionContext.setMaxAppAttempts(2);

      try {
        yarnClient.submitApplication(appSubmissionContext);
        return new ProcessControllerImpl(yarnClient, appId);
      } catch (Exception e) {
        LOG.error("Failed to submit application {}", appId, e);
        throw Throwables.propagate(e);
      }
    }
  };

  return new ApplicationMasterProcessLauncher(appId, submitter);
}
 
开发者ID:chtyim,项目名称:incubator-twill,代码行数:35,代码来源:Hadoop21YarnAppClient.java

示例7: startPSServer

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
@Override
public void startPSServer() throws AngelException {
  try {
    setUser();
    setLocalAddr();
    Path stagingDir = AngelApps.getStagingDir(conf, userName);

    // 2.get job id
    yarnClient = YarnClient.createYarnClient();
    YarnConfiguration yarnConf = new YarnConfiguration(conf);
    yarnClient.init(yarnConf);
    yarnClient.start();
    YarnClientApplication newApp;

    newApp = yarnClient.createApplication();
    GetNewApplicationResponse newAppResponse = newApp.getNewApplicationResponse();
    appId = newAppResponse.getApplicationId();
    JobID jobId = TypeConverter.fromYarn(appId);

    Path submitJobDir = new Path(stagingDir, appId.toString());
    jtFs = submitJobDir.getFileSystem(conf);

    conf.set("hadoop.http.filter.initializers",
        "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer");
    conf.set(AngelConf.ANGEL_JOB_DIR, submitJobDir.toString());
    conf.set(AngelConf.ANGEL_JOB_ID, jobId.toString());

    setInputDirectory();
    setOutputDirectory();

    // Credentials credentials = new Credentials();
    credentials.addAll(UserGroupInformation.getCurrentUser().getCredentials());
    TokenCache.obtainTokensForNamenodes(credentials, new Path[] {submitJobDir}, conf);
    checkParameters(conf);
    handleDeprecatedParameters(conf);

    // 4.copy resource files to hdfs
    copyAndConfigureFiles(conf, submitJobDir, (short) 10);

    // 5.write configuration to a xml file
    Path submitJobFile = JobSubmissionFiles.getJobConfPath(submitJobDir);
    TokenCache.cleanUpTokenReferral(conf);
    writeConf(conf, submitJobFile);

    // 6.create am container context
    ApplicationSubmissionContext appContext =
        createApplicationSubmissionContext(conf, submitJobDir, credentials, appId);

    conf.set(AngelConf.ANGEL_JOB_LIBJARS, "");

    // 7.Submit to ResourceManager
    appId = yarnClient.submitApplication(appContext);

    // 8.get app master client
    updateMaster(10 * 60);
    
    waitForAllPS(conf.getInt(AngelConf.ANGEL_PS_NUMBER, AngelConf.DEFAULT_ANGEL_PS_NUMBER));
    LOG.info("start pss success");
  } catch (Exception x) {
    LOG.error("submit application to yarn failed.", x);
    throw new AngelException(x);
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:64,代码来源:AngelYarnClient.java

示例8: submitApp

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:56,代码来源:AMSimulator.java

示例9: getNewApplicationId

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
private static ApplicationId getNewApplicationId(YarnClientRMConnection crmc) throws YarnRemoteException {
    GetNewApplicationRequest request = Records.newRecord(GetNewApplicationRequest.class);
    GetNewApplicationResponse response = crmc.getClientRMProtocol().getNewApplication(request);

    return response.getApplicationId();
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:7,代码来源:YarnApplication.java

示例10: submitApp

import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; //导入方法依赖的package包/类
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(50);
  }

  appAttemptId = rm.getRMContext().getRMApps().get(appId)
          .getCurrentAppAttempt().getAppAttemptId();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:49,代码来源:AMSimulator.java


注:本文中的org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse.getApplicationId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。