@@ -0,0 +1,2056 @@
+package hex.tree.drf;%0A%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport water.*;%0Aimport water.fvec.Frame;%0Aimport water.util.Log;%0A%0Aimport static org.junit.Assert.*;%0A%0Apublic class DRFConcurrentTest extends TestUtil  %7B%0A%0A  @BeforeClass%0A  public static void setup() %7B stall_till_cloudsize(1); %7D%0A%0A  @Test%0A  public void testBuildSingle() %7B%0A    Scope.enter();%0A    try %7B%0A      Frame fr = parse_test_file(Key.make(%22prostate_single.hex%22), %22smalldata/logreg/prostate.csv%22);%0A      Scope.track(fr);%0A      fr.remove(%22ID%22).remove();%0A      buildXValDRF(fr, %22AGE%22);%0A    %7D finally %7B%0A      Scope.exit();%0A    %7D%0A  %7D%0A%0A  @Test%0A  public void testBuildConcurrent() %7B%0A    Scope.enter();%0A    try %7B%0A      Frame fr = parse_test_file(Key.make(%22prostate_concurrent.hex%22), %22smalldata/logreg/prostate.csv%22);%0A      Scope.track(fr);%0A      fr.remove(%22ID%22).remove();%0A      TrainSingleFun fun = new TrainSingleFun(fr);%0A      H2O.submitTask(new LocalMR(fun, 100)).join();%0A    %7D finally %7B%0A      Scope.exit();%0A    %7D%0A  %7D%0A%0A  private static class TrainSingleFun extends MrFun%3CTrainSingleFun%3E %7B%0A    private final Frame _train;%0A    private TrainSingleFun(Frame train) %7B _train = train; %7D%0A    public TrainSingleFun() %7B _train = null; %7D%0A    @Override%0A    protected void map(int id) %7B%0A      assert _train != null;%0A      buildXValDRF(_train, %22AGE%22);%0A    %7D%0A  %7D%0A%0A  private static void buildXValDRF(Frame train, String response) %7B%0A    DRFModel model = null;%0A    try %7B%0A      Scope.enter();%0A      // Configure DRF%0A      DRFModel.DRFParameters drf = new DRFModel.DRFParameters();%0A      drf._train = train._key;%0A      drf._response_column = response;%0A      drf._seed = (1L%3C%3C32)%7C2;%0A      drf._nfolds = 5;%0A      drf._ntrees = 7;%0A%0A      model = new DRF(drf).trainModel().get();%0A%0A      assertNotNull(model);%0A      Log.info(model._output);%0A%0A      assertEquals(5, model._output._cross_validation_models.length);%0A    %7D finally %7B%0A      if (model != null) %7B%0A        model.delete();%0A        model.deleteCrossValidationModels();%0A        model.deleteCrossValidationPreds();%0A      %7D%0A      Scope.exit();%0A    %7D%0A  %7D%0A%0A%7D%0A

Test concurrent building of DRF models