Github user d2r commented on a diff in the pull request: https://github.com/apache/storm/pull/2881#discussion_r227979286 --- Diff: storm-client/src/jvm/org/apache/storm/utils/Utils.java --- @@ -119,15 +120,81 @@ // tests by subclassing. private static Utils _instance = new Utils(); private static String memoizedLocalHostnameString = null; - public static final Pattern TOPOLOGY_KEY_PATTERN = Pattern.compile("^[\\w \\t\\._-]+$", Pattern.UNICODE_CHARACTER_CLASS); + public static final Pattern TOPOLOGY_KEY_PATTERN = + Pattern.compile("^[\\w \\t\\._-]+$", Pattern.UNICODE_CHARACTER_CLASS); + + public static final String NUMA_MEMORY_IN_MB = "memory.mb"; + public static final String NUMA_CORES = "cores"; + public static final String NUMAS_PORTS = "ports"; + public static final String NUMA_ID = "node_id"; + public static final String NUMAS_BASE = "numas"; static { localConf = readStormConfig(); serializationDelegate = getSerializationDelegate(localConf); } /** - * Provide an instance of this class for delegates to use. To mock out delegated methods, provide an instance of a subclass that + * Validate supervisor numa configuration. + * @param stormConf stormConf + * @return getValidatedNumaMap + * @throws KeyNotFoundException + */ + public static Map<String, Object> getValidatedNumaMap(Map<String, Object> stormConf) throws KeyNotFoundException { + Map<String, Object> validatedNumaMap = new HashMap(); + Map<String, Object> supervisorNumaMap = + (Map<String, Object>) stormConf.get(Config.SUPERVISOR_NUMA_META); + if (supervisorNumaMap == null) { + return validatedNumaMap; + } + if (!supervisorNumaMap.containsKey(NUMAS_BASE)) { + throw new KeyNotFoundException( + "The numa configurations [" + NUMAS_BASE + "] is missing!" + ); + } + List<Map> numaEntries = (List<Map>) supervisorNumaMap.get(NUMAS_BASE); --- End diff -- Why is this a list of maps having `NUMA_ID` as a key instead of a Map of `NUMA_ID` to Maps having keys `NUMA_CORES, NUMA_MEMORY_IN_MB, NUMAS_PORTS`?
---