List of usage examples for org.apache.hadoop.yarn.client.api.async AMRMClientAsync createAMRMClientAsync
@Deprecated public static <T extends ContainerRequest> AMRMClientAsync<T> createAMRMClientAsync(AMRMClient<T> client, int intervalMs, CallbackHandler callbackHandler)
From source file:com.cloudera.llama.am.yarn.YarnRMConnector.java
License:Apache License
private void _registerSchedulerAndCreateNMClient(String queue) throws Exception { NMTokenCache nmTokenCache = new NMTokenCache(); nmClient = NMClient.createNMClient(); nmClient.setNMTokenCache(nmTokenCache); nmClient.init(yarnConf);/*from ww w.ja va 2s. co m*/ nmClient.start(); LOG.debug("Started NMClient, AM '{}' with scheduler for '{}' queue", appId, queue); int heartbeatInterval = getConf().getInt(HEARTBEAT_INTERVAL_KEY, HEARTBEAT_INTERNAL_DEFAULT); AMRMClient<LlamaContainerRequest> amRmClient = AMRMClient.createAMRMClient(); amRmClient.setNMTokenCache(nmTokenCache); amRmClientAsync = AMRMClientAsync.createAMRMClientAsync(amRmClient, heartbeatInterval, YarnRMConnector.this); amRmClientAsync.init(yarnConf); amRmClientAsync.start(); String urlWithoutScheme = getConf().get(ADVERTISED_TRACKING_URL_KEY, "http://") .substring("http://".length()); RegisterApplicationMasterResponse response = amRmClientAsync.registerApplicationMaster( getConf().get(ADVERTISED_HOSTNAME_KEY, ""), getConf().getInt(ADVERTISED_PORT_KEY, 0), urlWithoutScheme); maxResource = response.getMaximumResourceCapability(); nodes = Collections.synchronizedMap(new HashMap<String, Resource>()); for (NodeReport nodeReport : yarnClient.getNodeReports()) { if (nodeReport.getNodeState() == NodeState.RUNNING) { String nodeKey = getNodeName(nodeReport.getNodeId()); nodes.put(nodeKey, nodeReport.getCapability()); LOG.debug("Added node '{}' with '{}' cpus and '{}' memory", nodeKey, nodeReport.getCapability().getVirtualCores(), nodeReport.getCapability().getMemory()); } } LOG.debug("Registered with scheduler, AM '{}' for '{}' queue", appId, queue); }
From source file:org.apache.oozie.action.hadoop.AMRMClientAsyncFactory.java
License:Apache License
public AMRMClientAsync<?> createAMRMClientAsync(int intervalMs, AMRMCallBackHandler callBackHandler) { AMRMClient<?> amRmClient = AMRMClient.createAMRMClient(); AMRMClientAsync<?> amRmClientAsync = AMRMClientAsync.createAMRMClientAsync(amRmClient, intervalMs, callBackHandler);/* ww w . j a v a 2 s .c om*/ return amRmClientAsync; }