FairSchedulerConfiguration extends Configuration { public static Resource parseResourceConfigValue(String val) throws AllocationConfigurationException { try { int memory = findResource(val, "mb"); int vcores = findResource(val, "vcores"); return BuilderUtils.newResource(memory, vcores); } catch (AllocationConfigurationException ex) { throw ex; } catch (Exception ex) { throw new AllocationConfigurationException( "Error reading resource config", ex); } } FairSchedulerConfiguration();  FairSchedulerConfiguration(Configuration conf); Resource getMinimumAllocation(); Resource getMaximumAllocation(); Resource getIncrementAllocation(); float getLocalityThresholdNode(); float getLocalityThresholdRack(); boolean isContinuousSchedulingEnabled(); int getContinuousSchedulingSleepMs(); long getLocalityDelayNodeMs(); long getLocalityDelayRackMs(); boolean getPreemptionEnabled(); float getPreemptionUtilizationThreshold(); boolean getAssignMultiple(); int getMaxAssign(); boolean getSizeBasedWeight(); boolean isEventLogEnabled(); String getEventlogDir(); int getPreemptionInterval(); int getWaitTimeBeforeKill(); boolean getUsePortForNodeName(); static Resource parseResourceConfigValue(String val); long getUpdateInterval(); static final Log LOG; static final String RM_SCHEDULER_INCREMENT_ALLOCATION_MB; static final int DEFAULT_RM_SCHEDULER_INCREMENT_ALLOCATION_MB; static final String RM_SCHEDULER_INCREMENT_ALLOCATION_VCORES; static final int DEFAULT_RM_SCHEDULER_INCREMENT_ALLOCATION_VCORES; static final String ALLOCATION_FILE; static final String EVENT_LOG_ENABLED; static final boolean DEFAULT_EVENT_LOG_ENABLED; static final String ASSIGN_MULTIPLE; static final String UPDATE_INTERVAL_MS; static final int DEFAULT_UPDATE_INTERVAL_MS; }
@Test public void testParseResourceConfigValue() throws Exception { assertEquals(BuilderUtils.newResource(1024, 2), parseResourceConfigValue("2 vcores, 1024 mb")); assertEquals(BuilderUtils.newResource(1024, 2), parseResourceConfigValue("1024 mb, 2 vcores")); assertEquals(BuilderUtils.newResource(1024, 2), parseResourceConfigValue("2vcores,1024mb")); assertEquals(BuilderUtils.newResource(1024, 2), parseResourceConfigValue("1024mb,2vcores")); }
@Test(expected = AllocationConfigurationException.class) public void testNoUnits() throws Exception { parseResourceConfigValue("1024"); }
@Test(expected = AllocationConfigurationException.class) public void testOnlyMemory() throws Exception { parseResourceConfigValue("1024mb"); }
@Test(expected = AllocationConfigurationException.class) public void testOnlyCPU() throws Exception { parseResourceConfigValue("1024vcores"); }
@Test(expected = AllocationConfigurationException.class) public void testGibberish() throws Exception { parseResourceConfigValue("1o24vc0res"); }