Examples of MRPipelineExecution


Examples of org.apache.crunch.impl.mr.MRPipelineExecution

      in.count()
          .values()
          .parallelDo(new SleepForeverFn(), longs())
          .write(To.textFile(tmpDir.getPath("out_" + i)));
    }
    MRPipelineExecution exec = pipeline.runAsync();

    // Wait until both of the two jobs are submitted.
    List<MRJob> jobs = exec.getJobs();
    assertEquals(2, jobs.size());
    StopWatch watch = new StopWatch();
    watch.start();
    int numOfJobsSubmitted = 0;
    while (numOfJobsSubmitted < 2 && watch.getTime() < 10000) {
      numOfJobsSubmitted = 0;
      for (MRJob job : jobs) {
        if (job.getJobState() == MRJob.State.RUNNING) {
          numOfJobsSubmitted++;
        }
      }
      Thread.sleep(100);
    }
    assertEquals(2, numOfJobsSubmitted);

    // Kill one of them.
    Job job0 = jobs.get(0).getJob();
    job0.killJob();

    // Expect the pipeline exits and the other job is killed.
    StopWatch watch2 = new StopWatch();
    watch2.start();
    Job job1 = jobs.get(1).getJob();
    while (!job1.isComplete() && watch2.getTime() < 10000) {
      Thread.sleep(100);
    }
    assertTrue(job1.isComplete());
    assertEquals(PipelineExecution.Status.FAILED, exec.getStatus());
  }
View Full Code Here

Examples of org.apache.crunch.impl.mr.MRPipelineExecution

    // Write joins
    join1.keys().write(To.textFile(out1));
    join2.keys().write(To.textFile(out2));

    MRPipelineExecution exec = pipeline.runAsync();
    int fnCount = 0;
    for (String line : exec.getPlanDotFile().split("\n")) {
      if (line.contains("label=\"Transform pCol1 to PTable\"")) {
        fnCount++;
      }
    }
    assertEquals(breakpoint ? 1 : 2, fnCount);
    exec.waitUntilDone();
  }
View Full Code Here

Examples of org.apache.crunch.impl.mr.MRPipelineExecution

     op = op.parallelDo("op2", IdentityFn.<Pair<String,String>>getInstance(), tableOf(strings(), strings()),
         ParallelDoOptions.builder().sourceTargets(rd.getSourceTargets()).build());
    
     PCollection<String> output = op.values();
     output.write(To.textFile(out));
     MRPipelineExecution exec = p.runAsync();
     exec.waitUntilDone();
     List<MRJob> jobs = exec.getJobs();
     Assert.assertEquals(2, jobs.size());
     Assert.assertEquals(0, jobs.get(0).getJob().getNumReduceTasks());
     Assert.assertEquals(0, jobs.get(1).getJob().getNumReduceTasks());    
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.