Program: 32182
Project: 32182
Buggy source:
protected void runDistributedTrain() throws IOException, InterruptedException, ClassNotFoundException {
  LOG.info("String_Node_Str",isDryTrain ? "String_Node_Str" : "String_Node_Str");
  SourceType sourceType=super.getModelConfig().getDataSet().getSource();
  final List<String> args=new ArrayList<String>();
  prepareCommonParams(args,sourceType);
  Path tmpModelsPath=ShifuFileUtils.getFileSystemBySourceType(sourceType).makeQualified(new Path(super.getPathFinder().getPathBySourceType(new Path(Constants.TMP,Constants.DEFAULT_MODELS_TMP_FOLDER),sourceType)));
  args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.NN_TMP_MODELS_FOLDER,tmpModelsPath.toString()));
  int baggingNum=isForVarSelect ? 1 : super.getModelConfig().getBaggingNum();
  long start=System.currentTimeMillis();
  LOG.info("String_Node_Str",baggingNum);
  boolean isParallel=Boolean.valueOf(Environment.getProperty(SHIFU_DTRAIN_PARALLEL,SHIFU_DEFAULT_DTRAIN_PARALLEL)).booleanValue();
  GuaguaMapReduceClient guaguaClient=new GuaguaMapReduceClient();
  List<String> progressLogList=new ArrayList<String>(baggingNum);
  for (int i=0; i < baggingNum; i++) {
    args.add("String_Node_Str");
    args.add(String.format("String_Node_Str",super.getModelConfig().getModelSetName(),i + 1));
    LOG.info("String_Node_Str",(i + 1));
    String modelName=getModelName(i + 1);
    Path modelPath=ShifuFileUtils.getFileSystemBySourceType(sourceType).makeQualified(new Path(super.getPathFinder().getModelsPath(sourceType),modelName));
    args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.GUAGUA_NN_OUTPUT,modelPath.toString()));
    args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.NN_TRAINER_ID,String.valueOf(i + 1)));
    final String progressLogFile=getProgressLogFile(i + 1);
    progressLogList.add(progressLogFile);
    args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.NN_PROGRESS_FILE,progressLogFile));
    if (isParallel) {
      guaguaClient.addJob(args.toArray(new String[0]));
    }
 else {
      TailThread tailThread=startTailThread(new String[]{progressLogFile});
      guaguaClient.creatJob(args.toArray(new String[0])).waitForCompletion(true);
      stopTailThread(tailThread);
    }
  }
  if (isParallel) {
    TailThread tailThread=startTailThread(progressLogList.toArray(new String[0]));
    guaguaClient.run();
    stopTailThread(tailThread);
  }
  for (int i=0; i < baggingNum; i++) {
    String modelName=getModelName(i + 1);
    Path modelPath=ShifuFileUtils.getFileSystemBySourceType(sourceType).makeQualified(new Path(super.getPathFinder().getModelsPath(sourceType),modelName));
    copyModelToLocal(modelName,modelPath,sourceType);
  }
  copyTmpModelsToLocal(tmpModelsPath,sourceType);
  LOG.info("String_Node_Str",System.currentTimeMillis() - start);
}

Fixed version (ground truth):
protected void runDistributedTrain() throws IOException, InterruptedException, ClassNotFoundException {
  LOG.info("String_Node_Str",isDryTrain ? "String_Node_Str" : "String_Node_Str");
  SourceType sourceType=super.getModelConfig().getDataSet().getSource();
  final List<String> args=new ArrayList<String>();
  prepareCommonParams(args,sourceType);
  Path tmpModelsPath=ShifuFileUtils.getFileSystemBySourceType(sourceType).makeQualified(new Path(super.getPathFinder().getPathBySourceType(new Path(Constants.TMP,Constants.DEFAULT_MODELS_TMP_FOLDER),sourceType)));
  args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.NN_TMP_MODELS_FOLDER,tmpModelsPath.toString()));
  int baggingNum=isForVarSelect ? 1 : super.getModelConfig().getBaggingNum();
  long start=System.currentTimeMillis();
  LOG.info("String_Node_Str",baggingNum);
  boolean isParallel=Boolean.valueOf(Environment.getProperty(SHIFU_DTRAIN_PARALLEL,SHIFU_DEFAULT_DTRAIN_PARALLEL)).booleanValue();
  GuaguaMapReduceClient guaguaClient=new GuaguaMapReduceClient();
  List<String> progressLogList=new ArrayList<String>(baggingNum);
  for (int i=0; i < baggingNum; i++) {
    List<String> localArgs=new ArrayList<String>(args);
    localArgs.add("String_Node_Str");
    localArgs.add(String.format("String_Node_Str",super.getModelConfig().getModelSetName(),i + 1));
    LOG.info("String_Node_Str",(i + 1));
    String modelName=getModelName(i + 1);
    Path modelPath=ShifuFileUtils.getFileSystemBySourceType(sourceType).makeQualified(new Path(super.getPathFinder().getModelsPath(sourceType),modelName));
    localArgs.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.GUAGUA_NN_OUTPUT,modelPath.toString()));
    localArgs.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.NN_TRAINER_ID,String.valueOf(i + 1)));
    final String progressLogFile=getProgressLogFile(i + 1);
    progressLogList.add(progressLogFile);
    localArgs.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,NNConstants.NN_PROGRESS_FILE,progressLogFile));
    if (isParallel) {
      guaguaClient.addJob(localArgs.toArray(new String[0]));
    }
 else {
      TailThread tailThread=startTailThread(new String[]{progressLogFile});
      guaguaClient.creatJob(localArgs.toArray(new String[0])).waitForCompletion(true);
      stopTailThread(tailThread);
    }
  }
  if (isParallel) {
    TailThread tailThread=startTailThread(progressLogList.toArray(new String[0]));
    guaguaClient.run();
    stopTailThread(tailThread);
  }
  for (int i=0; i < baggingNum; i++) {
    String modelName=getModelName(i + 1);
    Path modelPath=ShifuFileUtils.getFileSystemBySourceType(sourceType).makeQualified(new Path(super.getPathFinder().getModelsPath(sourceType),modelName));
    copyModelToLocal(modelName,modelPath,sourceType);
  }
  copyTmpModelsToLocal(tmpModelsPath,sourceType);
  LOG.info("String_Node_Str",System.currentTimeMillis() - start);
}