List of usage examples for org.apache.hadoop.yarn.conf YarnConfiguration DEFAULT_NM_VCORES
int DEFAULT_NM_VCORES
To view the source code for org.apache.hadoop.yarn.conf YarnConfiguration DEFAULT_NM_VCORES.
Click Source Link
From source file:com.cloudera.llama.am.mock.MockRMConnector.java
License:Apache License
@Override public List<NodeInfo> getNodes() throws LlamaException { String[] nodeLocations = getConf().getStrings(NODES_KEY, NODES_DEFAULT); List<NodeInfo> nodes = new ArrayList<NodeInfo>(nodeLocations.length); for (String node : nodeLocations) { nodes.add(new NodeInfo(node, (short) YarnConfiguration.DEFAULT_NM_VCORES, YarnConfiguration.DEFAULT_NM_PMEM_MB)); }//w w w . j a va 2 s. c o m return nodes; }
From source file:com.cloudera.llama.nm.LlamaNMServer.java
License:Apache License
@Override protected void startService() { int memoryMb = conf.getInt(YarnConfiguration.NM_PMEM_MB, YarnConfiguration.DEFAULT_NM_PMEM_MB); int virtualCores = conf.getInt(YarnConfiguration.NM_VCORES, YarnConfiguration.DEFAULT_NM_VCORES); totalCapacity = Resource.newInstance(memoryMb, virtualCores); try {//from ww w . j a v a 2 s . co m clientNotificationService = new ClientNotificationService(getServerConf(), null, getMetricRegistry()); clientNotificationService.start(); } catch (Exception ex) { throw new RuntimeException(ex); } }
From source file:org.apache.flink.yarn.AbstractYarnClusterDescriptor.java
License:Apache License
private void isReadyForDeployment() throws YarnDeploymentException { if (taskManagerCount <= 0) { throw new YarnDeploymentException("Taskmanager count must be positive"); }/* w w w .ja v a 2 s . com*/ if (this.flinkJarPath == null) { throw new YarnDeploymentException("The Flink jar path is null"); } if (this.configurationDirectory == null) { throw new YarnDeploymentException("Configuration directory not set"); } if (this.flinkConfigurationPath == null) { throw new YarnDeploymentException("Configuration path not set"); } if (this.flinkConfiguration == null) { throw new YarnDeploymentException("Flink configuration object has not been set"); } // Check if we don't exceed YARN's maximum virtual cores. // The number of cores can be configured in the config. // If not configured, it is set to the number of task slots int numYarnVcores = conf.getInt(YarnConfiguration.NM_VCORES, YarnConfiguration.DEFAULT_NM_VCORES); int configuredVcores = flinkConfiguration.getInteger(ConfigConstants.YARN_VCORES, slots); // don't configure more than the maximum configured number of vcores if (configuredVcores > numYarnVcores) { throw new IllegalConfigurationException(String.format( "The number of virtual cores per node were configured with %d" + " but Yarn only has %d virtual cores available. Please note that the number" + " of virtual cores is set to the number of task slots by default unless configured" + " in the Flink config with '%s.'", configuredVcores, numYarnVcores, ConfigConstants.YARN_VCORES)); } // check if required Hadoop environment variables are set. If not, warn user if (System.getenv("HADOOP_CONF_DIR") == null && System.getenv("YARN_CONF_DIR") == null) { LOG.warn("Neither the HADOOP_CONF_DIR nor the YARN_CONF_DIR environment variable is set. " + "The Flink YARN Client needs one of these to be set to properly load the Hadoop " + "configuration for accessing YARN."); } }