private static ConfigurableResource parseOldStyleResource(String value) throws AllocationConfigurationException { final String lCaseValue = StringUtils.toLowerCase(value); int memory = findResource(lCaseValue, "mb"); int vcores = findResource(lCaseValue, "vcores"); return new ConfigurableResource( BuilderUtils.newResource(memory, vcores)); }
/** * Parses a resource config value of a form like "1024", "1024 mb", * or "1024 mb, 3 vcores". If no units are given, megabytes are assumed. * * @throws AllocationConfigurationException */ public static Resource parseResourceConfigValue(String val) throws AllocationConfigurationException { try { val = StringUtils.toLowerCase(val); 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); } }
/** * Parses a resource config value of a form like "1024", "1024 mb", * or "1024 mb, 3 vcores". If no units are given, megabytes are assumed. * * @throws AllocationConfigurationException */ public static Resource parseResourceConfigValue(String val) throws AllocationConfigurationException { try { val = StringUtils.toLowerCase(val); 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); } }