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


Java FinishApplicationMasterResponse类代码示例

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


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

示例1: main

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  if (args[0].equals("success")) {
    ApplicationMasterProtocol client = ClientRMProxy.createRMProxy(conf,
        ApplicationMasterProtocol.class);
    client.registerApplicationMaster(RegisterApplicationMasterRequest
        .newInstance(NetUtils.getHostname(), -1, ""));
    Thread.sleep(1000);
    FinishApplicationMasterResponse resp =
        client.finishApplicationMaster(FinishApplicationMasterRequest
          .newInstance(FinalApplicationStatus.SUCCEEDED, "success", null));
    assertTrue(resp.getIsUnregistered());
    System.exit(0);
  } else {
    System.exit(1);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestUnmanagedAMLauncher.java

示例2: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  String amrmToken = getAppIdentifier();
  Log.info("Finishing application attempt: " + amrmToken);

  synchronized (applicationContainerIdMap) {
    // Remove the containers that were being tracked for this application
    Assert.assertTrue("The application id is NOT registered: "
        + amrmToken, applicationContainerIdMap.containsKey(amrmToken));
    List<ContainerId> ids = applicationContainerIdMap.remove(amrmToken);
    for (ContainerId c : ids) {
      allocatedContainerMap.remove(c);
    }
  }

  return FinishApplicationMasterResponse
      .newInstance(request.getFinalApplicationStatus() == FinalApplicationStatus.SUCCEEDED ? true
          : false);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:MockResourceManagerFacade.java

示例3: testFinishOneApplicationMasterWithSuccess

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test
public void testFinishOneApplicationMasterWithSuccess() throws Exception {
  int testAppId = 1;
  RegisterApplicationMasterResponse registerResponse =
      registerApplicationMaster(testAppId);
  Assert.assertNotNull(registerResponse);
  Assert.assertEquals(Integer.toString(testAppId),
      registerResponse.getQueue());

  FinishApplicationMasterResponse finshResponse =
      finishApplicationMaster(testAppId,
          FinalApplicationStatus.SUCCEEDED);

  Assert.assertNotNull(finshResponse);
  Assert.assertEquals(true, finshResponse.getIsUnregistered());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:TestAMRMProxyService.java

示例4: testFinishOneApplicationMasterWithFailure

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test
public void testFinishOneApplicationMasterWithFailure() throws Exception {
  int testAppId = 1;
  RegisterApplicationMasterResponse registerResponse =
      registerApplicationMaster(testAppId);
  Assert.assertNotNull(registerResponse);
  Assert.assertEquals(Integer.toString(testAppId),
      registerResponse.getQueue());

  FinishApplicationMasterResponse finshResponse =
      finishApplicationMaster(testAppId, FinalApplicationStatus.FAILED);

  Assert.assertNotNull(finshResponse);
  Assert.assertEquals(false, finshResponse.getIsUnregistered());

  try {
    // Try to finish an application master that is already finished.
    finishApplicationMaster(testAppId, FinalApplicationStatus.SUCCEEDED);
    Assert
        .fail("The request to finish application master should have failed");
  } catch (Throwable ex) {
    // This is expected. So nothing required here.
    LOG.info("Finish registration failed as expected because it was not registered");
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:TestAMRMProxyService.java

示例5: testAllocateRequestWithNullValues

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test
public void testAllocateRequestWithNullValues() throws Exception {
  int testAppId = 1;
  RegisterApplicationMasterResponse registerResponse =
      registerApplicationMaster(testAppId);
  Assert.assertNotNull(registerResponse);
  Assert.assertEquals(Integer.toString(testAppId),
      registerResponse.getQueue());

  AllocateResponse allocateResponse = allocate(testAppId);
  Assert.assertNotNull(allocateResponse);

  FinishApplicationMasterResponse finshResponse =
      finishApplicationMaster(testAppId,
          FinalApplicationStatus.SUCCEEDED);

  Assert.assertNotNull(finshResponse);
  Assert.assertEquals(true, finshResponse.getIsUnregistered());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:TestAMRMProxyService.java

示例6: main

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  if (args[0].equals("success")) {
    ApplicationMasterProtocol client = ClientRMProxy.createRMProxy(conf,
        ApplicationMasterProtocol.class, true);
    client.registerApplicationMaster(RegisterApplicationMasterRequest
        .newInstance(NetUtils.getHostname(), -1, ""));
    Thread.sleep(1000);
    FinishApplicationMasterResponse resp =
        client.finishApplicationMaster(FinishApplicationMasterRequest
          .newInstance(FinalApplicationStatus.SUCCEEDED, "success", null));
    assertTrue(resp.getIsUnregistered());
    System.exit(0);
  } else {
    System.exit(1);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:TestUnmanagedAMLauncher.java

示例7: unregisterApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public void unregisterApplicationMaster(FinalApplicationStatus appStatus,
    String appMessage, String appTrackingUrl) throws YarnException,
    IOException {
  Preconditions.checkArgument(appStatus != null,
    "AppStatus should not be null.");
  FinishApplicationMasterRequest request =
      FinishApplicationMasterRequest.newInstance(appStatus, appMessage,
        appTrackingUrl);
  try {
    while (true) {
      FinishApplicationMasterResponse response =
          rmClient.finishApplicationMaster(request);
      if (response.getIsUnregistered()) {
        break;
      }
      LOG.info("Waiting for application to be successfully unregistered.");
      Thread.sleep(100);
    }
  } catch (InterruptedException e) {
    LOG.info("Interrupted while waiting for application"
        + " to be removed from RMStateStore");
  }
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:25,代码来源:AMRMClientImpl.java

示例8: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  FinishApplicationMasterRequestProto requestProto =
      ((FinishApplicationMasterRequestPBImpl) request).getProto();
  try {
    return new FinishApplicationMasterResponsePBImpl(
      proxy.finishApplicationMaster(null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ApplicationMasterProtocolPBClientImpl.java

示例9: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  // TODO Auto-generated method stub
  return null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestRPCFactories.java

示例10: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  resetStartFailoverFlag(true);
  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());
  return createFakeFinishApplicationMasterResponse();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ProtocolHATestBase.java

示例11: testFinishApplicationMasterOnHA

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test(timeout = 15000)
public void testFinishApplicationMasterOnHA() throws YarnException,
    IOException {
  FinishApplicationMasterRequest request =
      FinishApplicationMasterRequest.newInstance(
          FinalApplicationStatus.SUCCEEDED, "", "");
  FinishApplicationMasterResponse response =
      amClient.finishApplicationMaster(request);
  Assert.assertEquals(response,
      this.cluster.createFakeFinishApplicationMasterResponse());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestApplicationMasterServiceProtocolOnHA.java

示例12: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException, IOException {
  ApplicationMasterFinishRequest finishRequest = new ApplicationMasterFinishRequest(
      request.getFinalApplicationStatus(), request.getDiagnostics(),
      request.getTrackingUrl());
  ApplicationMasterFinishResponse response = applicationMaster
      .finishApplicationMaster(finishRequest);
  return FinishApplicationMasterResponse.newInstance(response
      .isUnregistered());
}
 
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:12,代码来源:HPCApplicationMasterProtocolImpl.java

示例13: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
/**
 * This is called by the AMs started on this node to unregister from the RM.
 * This method does the initial authorization and then forwards the request to
 * the application instance specific intercepter chain.
 */
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  LOG.info("Finishing application master. Tracking Url:"
      + request.getTrackingUrl());
  RequestInterceptorChainWrapper pipeline =
      authorizeAndGetInterceptorChain();
  return pipeline.getRootInterceptor().finishApplicationMaster(request);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:AMRMProxyService.java

示例14: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    final FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  LOG.info("Forwarding finish application request to "
      + "the real YARN Resource Manager");
  return rmClient.finishApplicationMaster(request);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:9,代码来源:DefaultRequestInterceptor.java

示例15: finishApplicationMaster

import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
/**
 * Unregisters the application master for specified application id
 * 
 * @param appId
 * @param status
 * @return
 * @throws Exception
 * @throws YarnException
 * @throws IOException
 */
protected FinishApplicationMasterResponse finishApplicationMaster(
    final int appId, final FinalApplicationStatus status)
    throws Exception, YarnException, IOException {

  final ApplicationUserInfo ugi = getApplicationUserInfo(appId);

  return ugi.getUser().doAs(
      new PrivilegedExceptionAction<FinishApplicationMasterResponse>() {
        @Override
        public FinishApplicationMasterResponse run() throws Exception {
          final FinishApplicationMasterRequest req =
              Records.newRecord(FinishApplicationMasterRequest.class);
          req.setDiagnostics("");
          req.setTrackingUrl("");
          req.setFinalApplicationStatus(status);

          FinishApplicationMasterResponse response =
              getAMRMProxyService().finishApplicationMaster(req);

          getAMRMProxyService().stopApp(
              ugi.getAppAttemptId().getApplicationId());

          return response;
        }
      });
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:37,代码来源:BaseAMRMProxyTest.java


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