Java Code Examples for org.apache.hadoop.yarn.client.ClientRMProxy#createRMProxy()

The following examples show how to use org.apache.hadoop.yarn.client.ClientRMProxy#createRMProxy() . 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: RMDelegationTokenIdentifier.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private static ApplicationClientProtocol getRmClient(Token<?> token,
    Configuration conf) throws IOException {
  String[] services = token.getService().toString().split(",");
  for (String service : services) {
    InetSocketAddress addr = NetUtils.createSocketAddr(service);
    if (localSecretManager != null) {
      // return null if it's our token
      if (localServiceAddress.getAddress().isAnyLocalAddress()) {
        if (NetUtils.isLocalAddress(addr.getAddress()) &&
            addr.getPort() == localServiceAddress.getPort()) {
          return null;
        }
      } else if (addr.equals(localServiceAddress)) {
        return null;
      }
    }
  }
  return ClientRMProxy.createRMProxy(conf, ApplicationClientProtocol.class);
}
 
Example 2
Source File: YarnClientImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  try {
    rmClient = ClientRMProxy.createRMProxy(getConfig(),
        ApplicationClientProtocol.class);
    if (historyServiceEnabled) {
      historyClient.start();
    }
    if (timelineServiceEnabled) {
      timelineClient.start();
    }
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
  super.serviceStart();
}
 
Example 3
Source File: TestUnmanagedAMLauncher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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);
  }
}
 
Example 4
Source File: RMDelegationTokenIdentifier.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static ApplicationClientProtocol getRmClient(Token<?> token,
    Configuration conf) throws IOException {
  String[] services = token.getService().toString().split(",");
  for (String service : services) {
    InetSocketAddress addr = NetUtils.createSocketAddr(service);
    if (localSecretManager != null) {
      // return null if it's our token
      if (localServiceAddress.getAddress().isAnyLocalAddress()) {
        if (NetUtils.isLocalAddress(addr.getAddress()) &&
            addr.getPort() == localServiceAddress.getPort()) {
          return null;
        }
      } else if (addr.equals(localServiceAddress)) {
        return null;
      }
    }
  }
  return ClientRMProxy.createRMProxy(conf, ApplicationClientProtocol.class);
}
 
Example 5
Source File: YarnClientImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  try {
    rmClient = ClientRMProxy.createRMProxy(getConfig(),
        ApplicationClientProtocol.class);
    if (historyServiceEnabled) {
      historyClient.start();
    }
    if (timelineServiceEnabled) {
      timelineClient.start();
    }
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
  super.serviceStart();
}
 
Example 6
Source File: TestUnmanagedAMLauncher.java    From big-c with Apache License 2.0 6 votes vote down vote up
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);
  }
}
 
Example 7
Source File: AppReportFetcher.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new Connection to the RM to fetch Application reports.
 * @param conf the conf to use to know where the RM is.
 */
public AppReportFetcher(Configuration conf) {
  this.conf = conf;
  try {
    applicationsManager = ClientRMProxy.createRMProxy(conf,
        ApplicationClientProtocol.class);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
Example 8
Source File: AMRMClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 9
Source File: RMAdminCLI.java    From hadoop with Apache License 2.0 5 votes vote down vote up
protected ResourceManagerAdministrationProtocol createAdminProtocol()
    throws IOException {
  // Get the current configuration
  final YarnConfiguration conf = new YarnConfiguration(getConf());
  return ClientRMProxy.createRMProxy(conf,
      ResourceManagerAdministrationProtocol.class);
}
 
Example 10
Source File: RMCommunicator.java    From hadoop with Apache License 2.0 5 votes vote down vote up
protected ApplicationMasterProtocol createSchedulerProxy() {
  final Configuration conf = getConfig();

  try {
    return ClientRMProxy.createRMProxy(conf, ApplicationMasterProtocol.class);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
Example 11
Source File: AppReportFetcher.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new Connection to the RM to fetch Application reports.
 * @param conf the conf to use to know where the RM is.
 */
public AppReportFetcher(Configuration conf) {
  this.conf = conf;
  try {
    applicationsManager = ClientRMProxy.createRMProxy(conf,
        ApplicationClientProtocol.class);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
Example 12
Source File: AMRMClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 13
Source File: RMAdminCLI.java    From big-c with Apache License 2.0 5 votes vote down vote up
protected ResourceManagerAdministrationProtocol createAdminProtocol()
    throws IOException {
  // Get the current configuration
  final YarnConfiguration conf = new YarnConfiguration(getConf());
  return ClientRMProxy.createRMProxy(conf,
      ResourceManagerAdministrationProtocol.class);
}
 
Example 14
Source File: RMCommunicator.java    From big-c with Apache License 2.0 5 votes vote down vote up
protected ApplicationMasterProtocol createSchedulerProxy() {
  final Configuration conf = getConfig();

  try {
    return ClientRMProxy.createRMProxy(conf, ApplicationMasterProtocol.class);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
Example 15
Source File: AggregatedLogDeletionService.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected ApplicationClientProtocol creatRMClient() throws IOException {
  return ClientRMProxy.createRMProxy(getConfig(),
    ApplicationClientProtocol.class);
}
 
Example 16
Source File: AggregatedLogDeletionService.java    From big-c with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected ApplicationClientProtocol creatRMClient() throws IOException {
  return ClientRMProxy.createRMProxy(getConfig(),
    ApplicationClientProtocol.class);
}