List of usage examples for org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair AllocationConfiguration AllocationConfiguration
public AllocationConfiguration(Configuration conf)
From source file:com.cloudera.llama.am.LlamaAMServer.java
License:Apache License
@Override protected void startService() { startHttpServer();//from w w w. jav a 2 s . com try { Security.loginToHadoop(getServerConf()); Class<? extends NodeMapper> klass = getServerConf().getNodeMappingClass(); nodeMapper = ReflectionUtils.newInstance(klass, getConf()); clientNotificationService = new ClientNotificationService(getServerConf(), nodeMapper, getMetricRegistry()); clientNotificationService.addListener(this); clientNotificationService.start(); clientNotificationService.addListener(restData); // For mapping reservations to queues and checking queue ACLs YarnConfiguration yarnConf = new YarnConfiguration(); // Check the token renew interval and set the default here so that we can // renew the RMConnectors properly. long renewInterval = yarnConf.getLong(YarnConfiguration.DELEGATION_TOKEN_MAX_LIFETIME_KEY, YarnConfiguration.DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT); LlamaAM.RM_CONNECTOR_RECYCLE_INTERVAL_DEFAULT = renewInterval * 3 / 4; allocConf = new AtomicReference<AllocationConfiguration>(); allocsLoader = new AllocationFileLoaderService(); allocsLoader.init(yarnConf); allocsLoader.setReloadListener(new AllocationFileLoaderService.Listener() { @Override public void onReload(AllocationConfiguration allocs) { allocConf.set(allocs); } }); try { allocsLoader.reloadAllocations(); allocsLoader.start(); } catch (Exception ex) { LOG.warn("Failed to load queue allocations"); } if (allocConf.get() == null) { allocConf.set(new AllocationConfiguration(yarnConf)); } getConf().set(YarnRMConnector.ADVERTISED_HOSTNAME_KEY, ThriftEndPoint.getServerAddress(getServerConf())); getConf().setInt(YarnRMConnector.ADVERTISED_PORT_KEY, ThriftEndPoint.getServerPort(getServerConf())); getConf().set(YarnRMConnector.ADVERTISED_TRACKING_URL_KEY, getHttpLlamaUI()); llamaAm = LlamaAM.create(getConf()); asyncListener = new AsyncLlamaAMListener(restData); asyncListener.setMetricRegistry(getMetricRegistry()); asyncListener.start(); llamaAm.addListener(asyncListener); llamaAm.setMetricRegistry(getMetricRegistry()); llamaAm.start(); } catch (Exception ex) { throw new RuntimeException(ex); } }