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


Java ApplicationMasterProtocol类代码示例

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


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

示例1: getRMAddress

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Private
@Override
protected InetSocketAddress getRMAddress(YarnConfiguration conf,
    Class<?> protocol) throws IOException {
  if (protocol == ApplicationClientProtocol.class) {
    return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_PORT);
  } else if (protocol == ResourceManagerAdministrationProtocol.class) {
    return conf.getSocketAddr(
        YarnConfiguration.RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_PORT);
  } else if (protocol == ApplicationMasterProtocol.class) {
    setAMRMTokenService(conf);
    return conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
        YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
        YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
  } else {
    String message = "Unsupported protocol found when creating the proxy " +
        "connection to ResourceManager: " +
        ((protocol != null) ? protocol.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:ClientRMProxy.java

示例2: testPbServerFactory

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
private void testPbServerFactory() {
  InetSocketAddress addr = new InetSocketAddress(0);
  Configuration conf = new Configuration();
  ApplicationMasterProtocol instance = new AMRMProtocolTestImpl();
  Server server = null;
  try {
    server = 
      RpcServerFactoryPBImpl.get().getServer(
          ApplicationMasterProtocol.class, instance, addr, conf, null, 1);
    server.start();
  } catch (YarnRuntimeException e) {
    e.printStackTrace();
    Assert.fail("Failed to create server");
  } finally {
    if (server != null) {
      server.stop();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestRPCFactories.java

示例3: initialize

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Before
public void initialize() throws Exception {
  startHACluster(0, false, false, true);
  attemptId = this.cluster.createFakeApplicationAttemptId();
  amClient = ClientRMProxy
      .createRMProxy(this.conf, ApplicationMasterProtocol.class);

  Token<AMRMTokenIdentifier> appToken =
      this.cluster.getResourceManager().getRMContext()
        .getAMRMTokenSecretManager().createAndGetAMRMToken(attemptId);
  appToken.setService(ClientRMProxy.getAMRMTokenService(conf));
  UserGroupInformation.setLoginUser(UserGroupInformation
      .createRemoteUser(UserGroupInformation.getCurrentUser()
          .getUserName()));
  UserGroupInformation.getCurrentUser().addToken(appToken);
  syncToken(appToken);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestApplicationMasterServiceProtocolOnHA.java

示例4: main

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的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

示例5: initialize

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Before
public void initialize() throws Exception {
  startHACluster(0, false, false, true);
  attemptId = this.cluster.createFakeApplicationAttemptId();

  Token<AMRMTokenIdentifier> appToken =
      this.cluster.getResourceManager().getRMContext()
        .getAMRMTokenSecretManager().createAndGetAMRMToken(attemptId);
  appToken.setService(ClientRMProxy.getAMRMTokenService(this.conf));
  UserGroupInformation.setLoginUser(UserGroupInformation
      .createRemoteUser(UserGroupInformation.getCurrentUser().getUserName()));
  UserGroupInformation.getCurrentUser().addToken(appToken);
  syncToken(appToken);

  amClient = ClientRMProxy
      .createRMProxy(this.conf, ApplicationMasterProtocol.class);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:TestApplicationMasterServiceProtocolOnHA.java

示例6: getRMAddress

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
private static InetSocketAddress getRMAddress(Configuration conf,
    Class<?> protocol) throws IOException {
  if (protocol == ApplicationClientProtocol.class) {
    return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADDRESS,
        YarnConfiguration.DEFAULT_RM_PORT);
  } else if (protocol == ResourceManagerAdministrationProtocol.class) {
    return conf.getSocketAddr(
        YarnConfiguration.RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
        YarnConfiguration.DEFAULT_RM_ADMIN_PORT);
  } else if (protocol == ApplicationMasterProtocol.class) {
    InetSocketAddress serviceAddr =
        conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
          YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
          YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
    setupTokens(serviceAddr);
    return serviceAddr;
  } else {
    String message = "Unsupported protocol found when creating the proxy " +
        "connection to ResourceManager: " +
        ((protocol != null) ? protocol.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:27,代码来源:ClientRMProxy.java

示例7: initialize

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Before
public void initialize() throws Exception {
  startHACluster(0, false, false, true, true);
  attemptId = this.cluster.createFakeApplicationAttemptId();
  
  appToken =
      this.cluster.getResourceManager().getRMContext()
        .getAMRMTokenSecretManager().createAndGetAMRMToken(attemptId);
  appToken.setService(ClientRMProxy.getAMRMTokenService(this.conf));
  UserGroupInformation.setLoginUser(UserGroupInformation
      .createRemoteUser(UserGroupInformation.getCurrentUser().getUserName()));
  UserGroupInformation.getCurrentUser().addToken(appToken);
  syncToken(appToken);
  
  amClient = ClientRMProxy
      .createRMProxy(this.conf, ApplicationMasterProtocol.class, true);

}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:TestApplicationMasterServiceProtocolOnHA.java

示例8: main

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的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

示例9: init

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Override
public void init(Configuration conf) {
  this.conf = conf;
  connectYarnClient();

  final YarnConfiguration yarnConf = new YarnConfiguration(conf);
  final YarnRPC rpc = YarnRPC.create(conf);
  final InetSocketAddress rmAddress = conf.getSocketAddr(
      YarnConfiguration.RM_SCHEDULER_ADDRESS,
      YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
      YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);

  UserGroupInformation currentUser;
  try {
    currentUser = UserGroupInformation.getCurrentUser();
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }

  rmClient = currentUser.doAs(new PrivilegedAction<ApplicationMasterProtocol>() {
    @Override
    public ApplicationMasterProtocol run() {
      return (ApplicationMasterProtocol) rpc.getProxy(ApplicationMasterProtocol.class, rmAddress, yarnConf);
    }
  });
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:27,代码来源:YarnTajoResourceManager.java

示例10: initiate

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Before
public void initiate() throws Exception {
  startHACluster(0, false, false, true);
  attemptId = this.cluster.createFakeApplicationAttemptId();
  amClient = ClientRMProxy
      .createRMProxy(this.conf, ApplicationMasterProtocol.class);

  AMRMTokenIdentifier id =
      new AMRMTokenIdentifier(attemptId);
  Token<AMRMTokenIdentifier> appToken =
      new Token<AMRMTokenIdentifier>(id, this.cluster.getResourceManager()
          .getRMContext().getAMRMTokenSecretManager());
  appToken.setService(new Text("appToken service"));
  UserGroupInformation.setLoginUser(UserGroupInformation
      .createRemoteUser(UserGroupInformation.getCurrentUser()
          .getUserName()));
  UserGroupInformation.getCurrentUser().addToken(appToken);
  syncToken(appToken);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:20,代码来源:TestApplicationMasterServiceOnHA.java

示例11: serviceInit

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  this.amRmProtocol = ClientRMProxy.createRMProxy(getConfig(), ApplicationMasterProtocol.class);
  this.rmPollInterval =
      conf.getInt(AngelConf.ANGEL_AM_HEARTBEAT_INTERVAL_MS,
          AngelConf.DEFAULT_ANGEL_AM_HEARTBEAT_INTERVAL_MS);
  RackResolver.init(conf);
  super.serviceInit(conf);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:10,代码来源:YarnContainerAllocator.java

示例12: createRMClient

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
private ApplicationMasterProtocol createRMClient(final MockRM rm,
    final Configuration conf, final YarnRPC rpc,
    UserGroupInformation currentUser) {
  return currentUser.doAs(new PrivilegedAction<ApplicationMasterProtocol>() {
    @Override
    public ApplicationMasterProtocol run() {
      return (ApplicationMasterProtocol) rpc.getProxy(ApplicationMasterProtocol.class, rm
        .getApplicationMasterService().getBindAddress(), conf);
    }
  });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestAMRMTokens.java

示例13: testAuthorizedAccess

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Test
public void testAuthorizedAccess() throws Exception {
  MyContainerManager containerManager = new MyContainerManager();
  rm =
      new MockRMWithAMS(conf, containerManager);
  rm.start();

  MockNM nm1 = rm.registerNode("localhost:1234", 5120);

  Map<ApplicationAccessType, String> acls =
      new HashMap<ApplicationAccessType, String>(2);
  acls.put(ApplicationAccessType.VIEW_APP, "*");
  RMApp app = rm.submitApp(1024, "appname", "appuser", acls);

  nm1.nodeHeartbeat(true);

  int waitCount = 0;
  while (containerManager.containerTokens == null && waitCount++ < 20) {
    LOG.info("Waiting for AM Launch to happen..");
    Thread.sleep(1000);
  }
  Assert.assertNotNull(containerManager.containerTokens);

  RMAppAttempt attempt = app.getCurrentAppAttempt();
  ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
  waitForLaunchedState(attempt);

  // Create a client to the RM.
  final Configuration conf = rm.getConfig();
  final YarnRPC rpc = YarnRPC.create(conf);

  UserGroupInformation currentUser = UserGroupInformation
      .createRemoteUser(applicationAttemptId.toString());
  Credentials credentials = containerManager.getContainerCredentials();
  final InetSocketAddress rmBindAddress =
      rm.getApplicationMasterService().getBindAddress();
  Token<? extends TokenIdentifier> amRMToken =
      MockRMWithAMS.setupAndReturnAMRMToken(rmBindAddress,
        credentials.getAllTokens());
  currentUser.addToken(amRMToken);
  ApplicationMasterProtocol client = currentUser
      .doAs(new PrivilegedAction<ApplicationMasterProtocol>() {
        @Override
        public ApplicationMasterProtocol run() {
          return (ApplicationMasterProtocol) rpc.getProxy(ApplicationMasterProtocol.class, rm
            .getApplicationMasterService().getBindAddress(), conf);
        }
      });

  RegisterApplicationMasterRequest request = Records
      .newRecord(RegisterApplicationMasterRequest.class);
  RegisterApplicationMasterResponse response =
      client.registerApplicationMaster(request);
  Assert.assertNotNull(response.getClientToAMTokenMasterKey());
  if (UserGroupInformation.isSecurityEnabled()) {
    Assert
      .assertTrue(response.getClientToAMTokenMasterKey().array().length > 0);
  }
  Assert.assertEquals("Register response has bad ACLs", "*",
      response.getApplicationACLs().get(ApplicationAccessType.VIEW_APP));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:62,代码来源:TestAMAuthorization.java

示例14: serviceStart

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  final YarnConfiguration conf = new YarnConfiguration(getConfig());
  try {
    rmClient =
        ClientRMProxy.createRMProxy(conf, ApplicationMasterProtocol.class);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
  super.serviceStart();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:AMRMClientImpl.java

示例15: createSchedulerProxy

import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; //导入依赖的package包/类
protected ApplicationMasterProtocol createSchedulerProxy() {
  final Configuration conf = getConfig();

  try {
    return ClientRMProxy.createRMProxy(conf, ApplicationMasterProtocol.class);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RMCommunicator.java


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