當前位置: 首頁>>代碼示例>>Java>>正文


Java ApplicationSubmissionContext.newInstance方法代碼示例

本文整理匯總了Java中org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext.newInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationSubmissionContext.newInstance方法的具體用法?Java ApplicationSubmissionContext.newInstance怎麽用?Java ApplicationSubmissionContext.newInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext的用法示例。


在下文中一共展示了ApplicationSubmissionContext.newInstance方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createRMApp

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
private static RMApp createRMApp(int id, Configuration conf, RMContext rmContext,
     final LogAggregationStatus aggStatus) {
  ApplicationId appId = ApplicationId.newInstance(CLUSTER_TIMESTAMP, id);
  ApplicationSubmissionContext submissionContext =
      ApplicationSubmissionContext.newInstance(appId, "test", "default",
          Priority.newInstance(0), null, true, true,
          2, Resource.newInstance(10, 2), "test");
  return new RMAppImpl(appId, rmContext, conf, "test",
      USER, "default", submissionContext, rmContext.getScheduler(),
      rmContext.getApplicationMasterService(),
      System.currentTimeMillis(), "test",
      null, null) {
    @Override
    public ApplicationReport createAndGetApplicationReport(
        String clientUserName, boolean allowAccess) {
      ApplicationReport report =
          super.createAndGetApplicationReport(clientUserName, allowAccess);
      report.setLogAggregationStatus(aggStatus);
      return report;
    }
  };
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:23,代碼來源:TestHadoopArchiveLogs.java

示例2: createAppSubmissionContext

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
/**
 * Create the actual ApplicationSubmissionContext to be submitted to the RM
 * from the information provided by the user.
 * 
 * @param newApp
 *          the information provided by the user
 * @return returns the constructed ApplicationSubmissionContext
 * @throws IOException
 */
protected ApplicationSubmissionContext createAppSubmissionContext(
    ApplicationSubmissionContextInfo newApp) throws IOException {

  // create local resources and app submission context

  ApplicationId appid;
  String error =
      "Could not parse application id " + newApp.getApplicationId();
  try {
    appid =
        ConverterUtils.toApplicationId(recordFactory,
          newApp.getApplicationId());
  } catch (Exception e) {
    throw new BadRequestException(error);
  }
  ApplicationSubmissionContext appContext =
      ApplicationSubmissionContext.newInstance(appid,
        newApp.getApplicationName(), newApp.getQueue(),
        Priority.newInstance(newApp.getPriority()),
        createContainerLaunchContext(newApp), newApp.getUnmanagedAM(),
        newApp.getCancelTokensWhenComplete(), newApp.getMaxAppAttempts(),
        createAppSubmissionContextResource(newApp),
        newApp.getApplicationType(),
        newApp.getKeepContainersAcrossApplicationAttempts(),
        newApp.getAppNodeLabelExpression(),
        newApp.getAMContainerNodeLabelExpression());
  appContext.setApplicationTags(newApp.getApplicationTags());

  return appContext;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:40,代碼來源:RMWebServices.java

示例3: submitAppAndGetAppId

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
private ApplicationId submitAppAndGetAppId(String submitter,
    String queueName, boolean setupACLs) throws Exception {

  GetNewApplicationRequest newAppRequest =
      GetNewApplicationRequest.newInstance();

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationId applicationId =
      submitterClient.getNewApplication(newAppRequest).getApplicationId();

  Resource resource = BuilderUtils.newResource(1024, 1);
  Map<ApplicationAccessType, String> acls = createACLs(submitter, setupACLs);
  ContainerLaunchContext amContainerSpec =
      ContainerLaunchContext.newInstance(null, null, null, null, null, acls);

  ApplicationSubmissionContext appSubmissionContext =
      ApplicationSubmissionContext.newInstance(applicationId,
        "applicationName", queueName, null, amContainerSpec, false, true, 1,
        resource, "applicationType");
  appSubmissionContext.setApplicationId(applicationId);
  appSubmissionContext.setQueue(queueName);

  SubmitApplicationRequest submitRequest =
      SubmitApplicationRequest.newInstance(appSubmissionContext);
  submitterClient.submitApplication(submitRequest);
  resourceManager.waitForState(applicationId, RMAppState.ACCEPTED);
  return applicationId;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:29,代碼來源:QueueACLsTestBase.java

示例4: testAppSubmissionWithInvalidDelegationToken

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
@Test(timeout=20000)
public void testAppSubmissionWithInvalidDelegationToken() throws Exception {
  Configuration conf = new Configuration();
  conf.set(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
      "kerberos");
  UserGroupInformation.setConfiguration(conf);
  MockRM rm = new MockRM(conf) {
    @Override
    protected void doSecureLogin() throws IOException {
      // Skip the login.
    }
  };
  ByteBuffer tokens = ByteBuffer.wrap("BOGUS".getBytes()); 
  ContainerLaunchContext amContainer =
      ContainerLaunchContext.newInstance(
          new HashMap<String, LocalResource>(), new HashMap<String, String>(),
          new ArrayList<String>(), new HashMap<String, ByteBuffer>(), tokens,
          new HashMap<ApplicationAccessType, String>());
  ApplicationSubmissionContext appSubContext =
      ApplicationSubmissionContext.newInstance(
          ApplicationId.newInstance(1234121, 0),
          "BOGUS", "default", Priority.UNDEFINED, amContainer, false,
          true, 1, Resource.newInstance(1024, 1, 1), "BOGUS");
  SubmitApplicationRequest request =
      SubmitApplicationRequest.newInstance(appSubContext);
  try {
    rm.getClientRMService().submitApplication(request);
    fail("Error was excepted.");
  } catch (YarnException e) {
    Assert.assertTrue(e.getMessage().contains(
        "Bad header found in token storage"));
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:35,代碼來源:TestDelegationTokenRenewer.java

示例5: createApplicationWithAMResource

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
protected void createApplicationWithAMResource(ApplicationAttemptId attId,
    String queue, String user, Resource amResource) {
  RMContext rmContext = resourceManager.getRMContext();
  RMApp rmApp = new RMAppImpl(attId.getApplicationId(), rmContext, conf,
      null, null, null, ApplicationSubmissionContext.newInstance(null, null,
      null, null, null, false, false, 0, amResource, null), null, null,
      0, null, null, null);
  rmContext.getRMApps().put(attId.getApplicationId(), rmApp);
  AppAddedSchedulerEvent appAddedEvent = new AppAddedSchedulerEvent(
      attId.getApplicationId(), queue, user);
  scheduler.handle(appAddedEvent);
  AppAttemptAddedSchedulerEvent attempAddedEvent =
      new AppAttemptAddedSchedulerEvent(attId, false);
  scheduler.handle(attempAddedEvent);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:16,代碼來源:FairSchedulerTestBase.java

示例6: testApplicationSubmissionContextPBImpl

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
@Test
public void testApplicationSubmissionContextPBImpl() throws Exception {
  validatePBImplRecord(ApplicationSubmissionContextPBImpl.class,
      ApplicationSubmissionContextProto.class);
  
  ApplicationSubmissionContext ctx =
      ApplicationSubmissionContext.newInstance(null, null, null, null, null,
          false, false, 0, Resources.none(), null, false, null, null);
  
  Assert.assertNotNull(ctx.getResource());
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:12,代碼來源:TestPBImplRecords.java

示例7: testAppSubmissionWithInvalidDelegationToken

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
@Test(timeout=20000)
public void testAppSubmissionWithInvalidDelegationToken() throws Exception {
  Configuration conf = new Configuration();
  conf.set(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
      "kerberos");
  UserGroupInformation.setConfiguration(conf);
  MockRM rm = new MockRM(conf) {
    @Override
    protected void doSecureLogin() throws IOException {
      // Skip the login.
    }
  };
  ByteBuffer tokens = ByteBuffer.wrap("BOGUS".getBytes()); 
  ContainerLaunchContext amContainer =
      ContainerLaunchContext.newInstance(
          new HashMap<String, LocalResource>(), new HashMap<String, String>(),
          new ArrayList<String>(), new HashMap<String, ByteBuffer>(), tokens,
          new HashMap<ApplicationAccessType, String>());
  ApplicationSubmissionContext appSubContext =
      ApplicationSubmissionContext.newInstance(
          ApplicationId.newInstance(1234121, 0),
          "BOGUS", "default", Priority.UNDEFINED, amContainer, false,
          true, 1, Resource.newInstance(1024, 1), "BOGUS");
  SubmitApplicationRequest request =
      SubmitApplicationRequest.newInstance(appSubContext);
  try {
    rm.getClientRMService().submitApplication(request);
    fail("Error was excepted.");
  } catch (YarnException e) {
    Assert.assertTrue(e.getMessage().contains(
        "Bad header found in token storage"));
  }
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:35,代碼來源:TestDelegationTokenRenewer.java

示例8: createRMApp

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
private RMApp createRMApp(Configuration conf) {
  ApplicationSubmissionContext submissionContext =
      ApplicationSubmissionContext.newInstance(appId, "test", "default",
        Priority.newInstance(0), null, false, true,
        2, Resource.newInstance(10, 2), "test");
  return new RMAppImpl(this.appId, this.rmContext,
    conf, "test", "test", "default", submissionContext,
    scheduler,
    this.rmContext.getApplicationMasterService(),
    System.currentTimeMillis(), "test",
    null, null);
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:13,代碼來源:TestRMAppLogAggregationStatus.java


注:本文中的org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext.newInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。