code: void preInitializeJob(JobInProgress job) {
      JobConf jobConf = job.getJobConf();
      
      // Compute number of slots required to run a single map/reduce task
      int slotsPerMap = 1;
      int slotsPerReduce = 1;
      if (memoryMatcher.isSchedulingBasedOnMemEnabled()) {
        slotsPerMap = jobConf.computeNumSlotsPerMap(getMemSizeForMapSlot());
       slotsPerReduce = 
         jobConf.computeNumSlotsPerReduce(getMemSizeForReduceSlot());
      }
      job.setNumSlotsPerMap(slotsPerMap);
      job.setNumSlotsPerReduce(slotsPerReduce);
    }
docs: Setup {@link CapacityTaskScheduler} specific information prior to
  job initialization.