public static Map < ResourceType , Integer > getResourceTypeToCountMap ( int numCpus , Map < Integer , Map < ResourceType , Integer > > cpuToResourcePartitioning ) { Map < ResourceType , Integer > ret = cpuToResourcePartitioning . get ( numCpus ) ; if ( ret == null ) { Map < ResourceType , Integer > oneCpuMap = cpuToResourcePartitioning . get ( 1 ) ; if ( oneCpuMap == null ) { throw new RuntimeException ( "No matching entry for cpu count: " + numCpus + " in node and no 1 cpu map" ) ; } ret = new EnumMap < ResourceType , Integer > ( ResourceType . class ) ; for ( ResourceType key : oneCpuMap . keySet ( ) ) { ret . put ( key , oneCpuMap . get ( key ) . intValue ( ) * numCpus ) ; } } return ret ; }
Get a mapping of the resource type to amount of resources for a given number of cpus .