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


Java KillApplicationRequest类代码示例

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


KillApplicationRequest类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了KillApplicationRequest类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyKillAppFailure

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
private void verifyKillAppFailure(String submitter, String killer,
    String queueName, boolean setupACLs) throws Exception {

  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);

  final KillApplicationRequest finishAppRequest =
      KillApplicationRequest.newInstance(applicationId);

  ApplicationClientProtocol killerClient = getRMClientForUser(killer);

  // Kill app as the killer
  try {
    killerClient.forceKillApplication(finishAppRequest);
    Assert.fail("App killing by the enemy should fail!!");
  } catch (YarnException e) {
    LOG.info("Got exception while killing app as the enemy", e);
    Assert.assertTrue(e.getMessage().contains(
      "User " + killer + " cannot perform operation MODIFY_APP on "
          + applicationId));
  }

  getRMClientForUser(submitter).forceKillApplication(finishAppRequest);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:QueueACLsTestBase.java

示例2: testForceKillNonExistingApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Test
public void testForceKillNonExistingApplication() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null, null);
  ApplicationId applicationId =
      BuilderUtils.newApplicationId(System.currentTimeMillis(), 0);
  KillApplicationRequest request =
      KillApplicationRequest.newInstance(applicationId);
  try {
    rmService.forceKillApplication(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Trying to kill an absent " +
            "application " + request.getApplicationId());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestClientRMService.java

示例3: testKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Test
public void testKillApplication() throws Exception {
  MockRM rm = new MockRM();
  rm.start();
  RMApp app = rm.submitApp(2000);

  Configuration conf = new Configuration();
  @SuppressWarnings("resource")
  final YarnClient client = new MockYarnClient();
  client.init(conf);
  client.start();

  client.killApplication(app.getApplicationId());
  verify(((MockYarnClient) client).getRMClient(), times(2))
    .forceKillApplication(any(KillApplicationRequest.class));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestYarnClient.java

示例4: testForceKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Test
public void testForceKillApplication() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null, null);
  ApplicationId applicationId =
      BuilderUtils.newApplicationId(System.currentTimeMillis(), 0);
  KillApplicationRequest request =
      KillApplicationRequest.newInstance(applicationId);
  try {
    rmService.forceKillApplication(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Trying to kill an absent " +
            "application " + request.getApplicationId());
  }
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:21,代码来源:TestClientRMService.java

示例5: forceKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Override
public KillApplicationResponse forceKillApplication(
    KillApplicationRequest request) throws YarnException, IOException {
  KillApplicationRequestProto requestProto =
      ((KillApplicationRequestPBImpl) request).getProto();
  try {
    return new KillApplicationResponsePBImpl(proxy.forceKillApplication(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ApplicationClientProtocolPBClientImpl.java

示例6: verifyKillAppSuccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
private void verifyKillAppSuccess(String submitter, String killer,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);

  final KillApplicationRequest finishAppRequest =
      KillApplicationRequest.newInstance(applicationId);

  ApplicationClientProtocol ownerClient = getRMClientForUser(killer);

  // Kill app as killer
  ownerClient.forceKillApplication(finishAppRequest);
  resourceManager.waitForState(applicationId, RMAppState.KILLED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:QueueACLsTestBase.java

示例7: verifyOwnerAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
private void verifyOwnerAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    // View as owner
    rmClient.getApplicationReport(appReportRequest);

    // List apps as owner
    Assert.assertEquals("App view by owner should list the apps!!", 1,
        rmClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as owner
    rmClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestApplicationACLs.java

示例8: verifySuperUserAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
private void verifySuperUserAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol superUserClient = getRMClientForUser(SUPER_USER);

    // View as the superUser
    superUserClient.getApplicationReport(appReportRequest);

    // List apps as superUser
    Assert.assertEquals("App view by super-user should list the apps!!", 2,
        superUserClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as the superUser
    superUserClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestApplicationACLs.java

示例9: verifyFriendAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
private void verifyFriendAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol friendClient = getRMClientForUser(FRIEND);

    // View as the friend
    friendClient.getApplicationReport(appReportRequest);

    // List apps as friend
    Assert.assertEquals("App view by a friend should list the apps!!", 3,
        friendClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as the friend
    friendClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestApplicationACLs.java

示例10: verifyAdministerQueueUserAccess

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
private void verifyAdministerQueueUserAccess() throws Exception {
  isQueueUser = true;
  AccessControlList viewACL = new AccessControlList("");
  viewACL.addGroup(FRIENDLY_GROUP);
  AccessControlList modifyACL = new AccessControlList("");
  modifyACL.addUser(FRIEND);
  ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

  final GetApplicationReportRequest appReportRequest = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  appReportRequest.setApplicationId(applicationId);
  final KillApplicationRequest finishAppRequest = recordFactory
      .newRecordInstance(KillApplicationRequest.class);
  finishAppRequest.setApplicationId(applicationId);

  ApplicationClientProtocol administerQueueUserRmClient =
      getRMClientForUser(QUEUE_ADMIN_USER);

  // View as the administerQueueUserRmClient
  administerQueueUserRmClient.getApplicationReport(appReportRequest);

  // List apps as administerQueueUserRmClient
  Assert.assertEquals("App view by queue-admin-user should list the apps!!",
      5, administerQueueUserRmClient.getApplications(
             recordFactory.newRecordInstance(GetApplicationsRequest.class))
             .getApplicationList().size());

  // Kill app as the administerQueueUserRmClient
  administerQueueUserRmClient.forceKillApplication(finishAppRequest);
  resourceManager.waitForState(applicationId, RMAppState.KILLED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:TestApplicationACLs.java

示例11: forceKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Override
public KillApplicationResponse forceKillApplication(
    KillApplicationRequest request) throws YarnException {
  ApplicationId applicationId = request.getApplicationId();
  RMApp application = this.rmContext.getRMApps().get(applicationId);
  if (application.isAppFinalStateStored()) {
    return KillApplicationResponse.newInstance(true);
  } else {
    return KillApplicationResponse.newInstance(false);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestKillApplicationWithRMHA.java

示例12: testMoveTooLate

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Test (timeout = 10000)
public void testMoveTooLate() throws Exception {
  // Submit application
  Application application = new Application("user1", resourceManager);
  ApplicationId appId = application.getApplicationId();
  application.submit();
  
  ClientRMService clientRMService = resourceManager.getClientRMService();
  // Kill the application
  clientRMService.forceKillApplication(
      KillApplicationRequest.newInstance(appId));
  RMApp rmApp = resourceManager.getRMContext().getRMApps().get(appId);
  // wait until it's dead
  while (rmApp.getState() != RMAppState.KILLED) {
    Thread.sleep(100);
  }
  
  try {
    clientRMService.moveApplicationAcrossQueues(
        MoveApplicationAcrossQueuesRequest.newInstance(appId, "newqueue"));
    fail("Should have hit exception");
  } catch (YarnException ex) {
    assertEquals(YarnException.class,
        ex.getClass());
    assertEquals("App in KILLED state cannot be moved.", ex.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestMoveApplication.java

示例13: killApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Override
public void killApplication(ApplicationId applicationId)
    throws YarnException, IOException {
  KillApplicationRequest request =
      Records.newRecord(KillApplicationRequest.class);
  request.setApplicationId(applicationId);

  try {
    int pollCount = 0;
    long startTime = System.currentTimeMillis();

    while (true) {
      KillApplicationResponse response =
          rmClient.forceKillApplication(request);
      if (response.getIsKillCompleted()) {
        LOG.info("Killed application " + applicationId);
        break;
      }

      long elapsedMillis = System.currentTimeMillis() - startTime;
      if (enforceAsyncAPITimeout() &&
          elapsedMillis >= this.asyncApiPollTimeoutMillis) {
        throw new YarnException("Timed out while waiting for application " +
          applicationId + " to be killed.");
      }

      if (++pollCount % 10 == 0) {
        LOG.info("Waiting for application " + applicationId + " to be killed.");
      }
      Thread.sleep(asyncApiPollIntervalMillis);
    }
  } catch (InterruptedException e) {
    LOG.error("Interrupted while waiting for application " + applicationId
        + " to be killed.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:YarnClientImpl.java

示例14: forceKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入依赖的package包/类
@Override
public KillApplicationResponse forceKillApplication(
    KillApplicationRequest request) throws YarnException {
  resetStartFailoverFlag(true);

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

  return KillApplicationResponse.newInstance(true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:ProtocolHATestBase.java


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