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

The following examples show how to use org.apache.hadoop.yarn.server.api.ResourceTracker. These examples are extracted from open source projects. 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 Project: hadoop   Source File: TestYSCRPCFactories.java    License: 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 2
Source Project: big-c   Source File: TestYSCRPCFactories.java    License: 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
@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 4
Source Project: hadoop   Source File: TestResourceTrackerPBClientImpl.java    License: 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 Project: hadoop   Source File: TestNodeStatusUpdater.java    License: 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 6
Source Project: hadoop   Source File: ResourceTrackerService.java    License: 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 7
Source Project: big-c   Source File: TestResourceTrackerPBClientImpl.java    License: 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 Project: big-c   Source File: TestNodeStatusUpdater.java    License: 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 9
Source Project: big-c   Source File: ResourceTrackerService.java    License: 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 10
Source Project: hadoop   Source File: ResourceTrackerPBServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
public ResourceTrackerPBServiceImpl(ResourceTracker impl) {
  this.real = impl;
}
 
Example 11
Source Project: hadoop   Source File: NodeStatusUpdaterImpl.java    License: 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 12
Source Project: hadoop   Source File: BaseContainerManagerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return new LocalRMInterface();
}
 
Example 13
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 14
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 15
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 16
Source Project: hadoop   Source File: TestNodeStatusUpdater.java    License: 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 Project: hadoop   Source File: MockNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
protected ResourceTracker createResourceTracker() {
  return new MockResourceTracker();
}
 
Example 18
Source Project: hadoop   Source File: MockNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 19
Source Project: hadoop   Source File: TestResourceTrackerOnHA.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceTracker getRMClient() throws IOException {
  return ServerRMProxy.createRMProxy(this.conf, ResourceTracker.class);
}
 
Example 20
Source Project: big-c   Source File: ResourceTrackerPBServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
public ResourceTrackerPBServiceImpl(ResourceTracker impl) {
  this.real = impl;
}
 
Example 21
Source Project: big-c   Source File: NodeStatusUpdaterImpl.java    License: 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 Project: big-c   Source File: BaseContainerManagerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return new LocalRMInterface();
}
 
Example 23
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 24
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 25
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 26
Source Project: big-c   Source File: TestNodeStatusUpdater.java    License: 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 27
Source Project: big-c   Source File: MockNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
protected ResourceTracker createResourceTracker() {
  return new MockResourceTracker();
}
 
Example 28
Source Project: big-c   Source File: MockNodeStatusUpdater.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResourceTracker getRMClient() {
  return resourceTracker;
}
 
Example 29
Source Project: big-c   Source File: TestResourceTrackerOnHA.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceTracker getRMClient() throws IOException {
  return ServerRMProxy.createRMProxy(this.conf, ResourceTracker.class);
}