public boolean checkMinimumSlotsAvailable ( ClusterStatus clusterStatus , TaskType type ) { Map < String , Integer > poolToMinSlots = ( type == TaskType . MAP ) ? mapAllocs : reduceAllocs ; int totalSlots = ( type == TaskType . MAP ) ? clusterStatus . getMaxMapTasks ( ) : clusterStatus . getMaxReduceTasks ( ) ; int totalMinSlots = 0 ; for ( int minSlots : poolToMinSlots . values ( ) ) { totalMinSlots += minSlots ; } if ( totalMinSlots > totalSlots ) { LOG . warn ( String . format ( "Bad minimum %s slot configuration. cluster:%s totalMinSlots:%s" , type , totalSlots , totalMinSlots ) ) ; return false ; } LOG . info ( String . format ( "Minimum %s slots checked. cluster:%s totalMinSlots:%s" , type , totalSlots , totalSlots ) ) ; return true ; }
Check if the minimum slots set in the configuration is feasible