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


Java KillApplicationRequest.newInstance方法代码示例

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


在下文中一共展示了KillApplicationRequest.newInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: killApp

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
public KillApplicationResponse killApp(ApplicationId appId) throws Exception {
  ApplicationClientProtocol client = getClientRMService();
  KillApplicationRequest req = KillApplicationRequest.newInstance(appId);
  return client.forceKillApplication(req);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:MockRM.java

示例6: testForceKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
@Test
public void testForceKillApplication() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  MockRM rm = new MockRM();
  rm.init(conf);
  rm.start();

  ClientRMService rmService = rm.getClientRMService();
  GetApplicationsRequest getRequest = GetApplicationsRequest.newInstance(
      EnumSet.of(YarnApplicationState.KILLED));

  RMApp app1 = rm.submitApp(1024);
  RMApp app2 = rm.submitApp(1024, true);

  assertEquals("Incorrect number of apps in the RM", 0,
      rmService.getApplications(getRequest).getApplicationList().size());

  KillApplicationRequest killRequest1 =
      KillApplicationRequest.newInstance(app1.getApplicationId());
  KillApplicationRequest killRequest2 =
      KillApplicationRequest.newInstance(app2.getApplicationId());

  int killAttemptCount = 0;
  for (int i = 0; i < 100; i++) {
    KillApplicationResponse killResponse1 =
        rmService.forceKillApplication(killRequest1);
    killAttemptCount++;
    if (killResponse1.getIsKillCompleted()) {
      break;
    }
    Thread.sleep(10);
  }
  assertTrue("Kill attempt count should be greater than 1 for managed AMs",
      killAttemptCount > 1);
  assertEquals("Incorrect number of apps in the RM", 1,
      rmService.getApplications(getRequest).getApplicationList().size());

  KillApplicationResponse killResponse2 =
      rmService.forceKillApplication(killRequest2);
  assertTrue("Killing UnmanagedAM should falsely acknowledge true",
      killResponse2.getIsKillCompleted());
  for (int i = 0; i < 100; i++) {
    if (2 ==
        rmService.getApplications(getRequest).getApplicationList().size()) {
      break;
    }
    Thread.sleep(10);
  }
  assertEquals("Incorrect number of apps in the RM", 2,
      rmService.getApplications(getRequest).getApplicationList().size());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:52,代码来源:TestClientRMService.java

示例7: testForceKillApplication

import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; //导入方法依赖的package包/类
@Test
public void testForceKillApplication() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setBoolean(MockRM.ENABLE_WEBAPP, true);
  MockRM rm = new MockRM(conf);
  rm.init(conf);
  rm.start();

  ClientRMService rmService = rm.getClientRMService();
  GetApplicationsRequest getRequest = GetApplicationsRequest.newInstance(
      EnumSet.of(YarnApplicationState.KILLED));

  RMApp app1 = rm.submitApp(1024);
  RMApp app2 = rm.submitApp(1024, true);

  assertEquals("Incorrect number of apps in the RM", 0,
      rmService.getApplications(getRequest).getApplicationList().size());

  KillApplicationRequest killRequest1 =
      KillApplicationRequest.newInstance(app1.getApplicationId());
  String diagnostic = "message1";
  killRequest1.setDiagnostics(diagnostic);
  KillApplicationRequest killRequest2 =
      KillApplicationRequest.newInstance(app2.getApplicationId());

  int killAttemptCount = 0;
  for (int i = 0; i < 100; i++) {
    KillApplicationResponse killResponse1 =
        rmService.forceKillApplication(killRequest1);
    killAttemptCount++;
    if (killResponse1.getIsKillCompleted()) {
      break;
    }
    Thread.sleep(10);
  }
  assertTrue("Kill attempt count should be greater than 1 for managed AMs",
      killAttemptCount > 1);
  assertEquals("Incorrect number of apps in the RM", 1,
      rmService.getApplications(getRequest).getApplicationList().size());
  assertTrue("Diagnostic message is incorrect",
      app1.getDiagnostics().toString().contains(diagnostic));

  KillApplicationResponse killResponse2 =
      rmService.forceKillApplication(killRequest2);
  assertTrue("Killing UnmanagedAM should falsely acknowledge true",
      killResponse2.getIsKillCompleted());
  for (int i = 0; i < 100; i++) {
    if (2 ==
        rmService.getApplications(getRequest).getApplicationList().size()) {
      break;
    }
    Thread.sleep(10);
  }
  assertEquals("Incorrect number of apps in the RM", 2,
      rmService.getApplications(getRequest).getApplicationList().size());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:57,代码来源:TestClientRMService.java


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