org.apache.hadoop.yarn.server.api.ResourceTracker Java Examples

The following examples show how to use org.apache.hadoop.yarn.server.api.ResourceTracker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MiniYARNClusterSplice.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected NodeStatusUpdater createNodeStatusUpdater(Context context,
                                                    Dispatcher dispatcher, NodeHealthCheckerService healthChecker) {
    return new NodeStatusUpdaterImpl(context, dispatcher,
                                     healthChecker, metrics) {
        @Override
        protected ResourceTracker getRMClient() {
            final ResourceTrackerService rt =
                getResourceManager().getResourceTrackerService();
            final RecordFactory recordFactory =
                RecordFactoryProvider.getRecordFactory(null);

            // For in-process communication without RPC
            return Utils.getResourceTracker(rt);
        }

        @Override
        protected void stopRMProxy() { }
     };
}
 
Example #2
Source File: TestYSCRPCFactories.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void testPbServerFactory() {
  InetSocketAddress addr = new InetSocketAddress(0);
  Configuration conf = new Configuration();
  ResourceTracker instance = new ResourceTrackerTestImpl();
  Server server = null;
  try {
    server = 
      RpcServerFactoryPBImpl.get().getServer(
          ResourceTracker.class, instance, addr, conf, null, 1);
    server.start();
  } catch (YarnRuntimeException e) {
    e.printStackTrace();
    Assert.fail("Failed to create server");
  } finally {
    server.stop();
  }
}
 
Example #3
Source File: TestYSCRPCFactories.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void testPbServerFactory() {
  InetSocketAddress addr = new InetSocketAddress(0);
  Configuration conf = new Configuration();
  ResourceTracker instance = new ResourceTrackerTestImpl();
  Server server = null;
  try {
    server = 
      RpcServerFactoryPBImpl.get().getServer(
          ResourceTracker.class, instance, addr, conf, null, 1);
    server.start();
  } catch (YarnRuntimeException e) {
    e.printStackTrace();
    Assert.fail("Failed to create server");
  } finally {
    server.stop();
  }
}
 
Example #4
Source File: TestResourceTrackerPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void start() {
  InetSocketAddress address = new InetSocketAddress(0);
  Configuration configuration = new Configuration();
  ResourceTracker instance = new ResourceTrackerTestImpl();
  server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class,
      instance, address, configuration, null, 1);
  server.start();

  client = (ResourceTracker) RpcClientFactoryPBImpl.get().getClient(
      ResourceTracker.class, 1, NetUtils.getConnectAddress(server),
      configuration);

}
 
Example #5
Source File: ResourceTrackerService.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  super.serviceStart();
  // ResourceTrackerServer authenticates NodeManager via Kerberos if
  // security is enabled, so no secretManager.
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
    rpc.getServer(ResourceTracker.class, this, resourceTrackerAddress,
        conf, null,
        conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, 
            YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    InputStream inputStream =
        this.rmContext.getConfigurationProvider()
            .getConfigurationInputStream(conf,
                YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE);
    if (inputStream != null) {
      conf.addResource(inputStream);
    }
    refreshServiceAcls(conf, RMPolicyProvider.getInstance());
  }
 
  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
	   YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS,
	   YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS,
                         server.getListenerAddress());
}
 
Example #6
Source File: TestNodeStatusUpdater.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
protected ResourceTracker getRMClient() throws IOException {
  RetryPolicy retryPolicy = RMProxy.createRetryPolicy(conf);
  resourceTracker =
      (ResourceTracker) RetryProxy.create(ResourceTracker.class,
        new MyResourceTracker6(rmStartIntervalMS, rmNeverStart),
        retryPolicy);
  return resourceTracker;
}
 
Example #7
Source File: TestResourceTrackerPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void start() {
  InetSocketAddress address = new InetSocketAddress(0);
  Configuration configuration = new Configuration();
  ResourceTracker instance = new ResourceTrackerTestImpl();
  server = RpcServerFactoryPBImpl.get().getServer(ResourceTracker.class,
      instance, address, configuration, null, 1);
  server.start();

  client = (ResourceTracker) RpcClientFactoryPBImpl.get().getClient(
      ResourceTracker.class, 1, NetUtils.getConnectAddress(server),
      configuration);

}
 
Example #8
Source File: ResourceTrackerService.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  super.serviceStart();
  // ResourceTrackerServer authenticates NodeManager via Kerberos if
  // security is enabled, so no secretManager.
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
    rpc.getServer(ResourceTracker.class, this, resourceTrackerAddress,
        conf, null,
        conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, 
            YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    InputStream inputStream =
        this.rmContext.getConfigurationProvider()
            .getConfigurationInputStream(conf,
                YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE);
    if (inputStream != null) {
      conf.addResource(inputStream);
    }
    refreshServiceAcls(conf, RMPolicyProvider.getInstance());
  }
 
  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
	   YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS,
	   YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS,
                         server.getListenerAddress());
}
 
Example #9
Source File: TestNodeStatusUpdater.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
protected ResourceTracker getRMClient() throws IOException {
  RetryPolicy retryPolicy = RMProxy.createRetryPolicy(conf);
  resourceTracker =
      (ResourceTracker) RetryProxy.create(ResourceTracker.class,
        new MyResourceTracker6(rmStartIntervalMS, rmNeverStart),
        retryPolicy);
  return resourceTracker;
}
 
Example #10
Source File: BaseContainerManagerTest.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return new LocalRMInterface();
}
 
Example #11
Source File: ResourceTrackerPBServiceImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public ResourceTrackerPBServiceImpl(ResourceTracker impl) {
  this.real = impl;
}
 
Example #12
Source File: TestResourceTrackerOnHA.java    From big-c with Apache License 2.0 4 votes vote down vote up
private ResourceTracker getRMClient() throws IOException {
  return ServerRMProxy.createRMProxy(this.conf, ResourceTracker.class);
}
 
Example #13
Source File: NodeStatusUpdaterImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected ResourceTracker getRMClient() throws IOException {
  Configuration conf = getConfig();
  return ServerRMProxy.createRMProxy(conf, ResourceTracker.class);
}
 
Example #14
Source File: MockNodeStatusUpdater.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #15
Source File: MockNodeStatusUpdater.java    From big-c with Apache License 2.0 4 votes vote down vote up
protected ResourceTracker createResourceTracker() {
  return new MockResourceTracker();
}
 
Example #16
Source File: TestNodeStatusUpdater.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  RetryPolicy retryPolicy = RMProxy.createRetryPolicy(conf);
  return (ResourceTracker) RetryProxy.create(ResourceTracker.class,
    resourceTracker, retryPolicy);
}
 
Example #17
Source File: BaseContainerManagerTest.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return new LocalRMInterface();
}
 
Example #18
Source File: TestNodeStatusUpdater.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #19
Source File: TestNodeStatusUpdater.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #20
Source File: TestNodeStatusUpdater.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #21
Source File: NodeStatusUpdaterImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected ResourceTracker getRMClient() throws IOException {
  Configuration conf = getConfig();
  return ServerRMProxy.createRMProxy(conf, ResourceTracker.class);
}
 
Example #22
Source File: TestNodeStatusUpdater.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #23
Source File: TestNodeStatusUpdater.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #24
Source File: ResourceTrackerPBServiceImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public ResourceTrackerPBServiceImpl(ResourceTracker impl) {
  this.real = impl;
}
 
Example #25
Source File: TestResourceTrackerOnHA.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private ResourceTracker getRMClient() throws IOException {
  return ServerRMProxy.createRMProxy(this.conf, ResourceTracker.class);
}
 
Example #26
Source File: TestNodeStatusUpdater.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #27
Source File: MockNodeStatusUpdater.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example #28
Source File: MockNodeStatusUpdater.java    From hadoop with Apache License 2.0 4 votes vote down vote up
protected ResourceTracker createResourceTracker() {
  return new MockResourceTracker();
}
 
Example #29
Source File: TestNodeStatusUpdater.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  RetryPolicy retryPolicy = RMProxy.createRetryPolicy(conf);
  return (ResourceTracker) RetryProxy.create(ResourceTracker.class,
    resourceTracker, retryPolicy);
}