コード例 #1
0
ファイル: ParamSpaceUtils.java プロジェクト: Jsalim/Starfish
  /**
   * Adjusts the domain of some parameter descriptors based on information from the cluster, the
   * configuration, and the virtual job profile. Currently, the parameters adjusted are:
   *
   * <ul>
   *   <li>io.sort.mb
   *   <li>mapred.job.reduce.input.buffer.percent
   *   <li>mapred.reduce.tasks
   * </ul>
   *
   * @param space the parameter space
   * @param cluster the cluster
   * @param conf the configuration
   * @param jobProfile the virtual job profile
   */
  public static void adjustParameterDescriptors(
      ParameterSpace space,
      ClusterConfiguration cluster,
      Configuration conf,
      MRJobProfile jobProfile) {

    long taskMemory = ProfileUtils.getTaskMemory(conf);

    // Adjust the max value of io.sort.mb
    if (space.containsParamDescriptor(HadoopParameter.SORT_MB)) {

      adjustParamDescrSortMB(
          (IntegerParamDescriptor) space.getParameterDescriptor(HadoopParameter.SORT_MB),
          jobProfile,
          taskMemory);
    }

    // Adjust the max value of mapred.job.reduce.input.buffer.percent
    if (space.containsParamDescriptor(HadoopParameter.RED_IN_BUFF_PERC)) {

      adjustParamDescrRedInBufferPerc(
          (DoubleParamDescriptor) space.getParameterDescriptor(HadoopParameter.RED_IN_BUFF_PERC),
          jobProfile,
          taskMemory);
    }

    // Adjust the min and max number of mapred.reduce.tasks
    if (space.containsParamDescriptor(HadoopParameter.RED_TASKS)) {

      adjustParamDescrRedTasks(
          (IntegerParamDescriptor) space.getParameterDescriptor(HadoopParameter.RED_TASKS),
          jobProfile,
          taskMemory,
          cluster.getTotalReduceSlots());
    }
  }