Package org.springframework.data.hadoop.mapreduce.JobUtils

Examples of org.springframework.data.hadoop.mapreduce.JobUtils.JobStatus


   * @throws Exception if exception occurred
   */
  protected JobStatus waitStatus(Job job, long timeout, TimeUnit unit, JobStatus... jobStatuses) throws Exception {
    Assert.notNull(job, "Hadoop job must be set");

    JobStatus status = null;
    long end = System.currentTimeMillis() + unit.toMillis(timeout);

    // break label for inner loop
    done: do {
      status = findStatus(job);
      if (status == null) {
        break;
      }
      for (JobStatus statusCheck : jobStatuses) {
        if (status.equals(statusCheck)) {
          break done;
        }
      }
      Thread.sleep(1000);
    } while (System.currentTimeMillis() < end);
View Full Code Here


              throw new IllegalStateException(ex);
            }

            if (!succes) {
              if (!shuttingDown) {
                JobStatus status = JobUtils.getStatus(job);
                if (JobStatus.KILLED == status) {
                  throw new IllegalStateException("Job " + job.getJobName() + "] killed");
                }
                else {
                  throw new IllegalStateException("Job " + job.getJobName() + "] failed to start; status=" +status);
View Full Code Here

    checkHadoopJobWasKilled(victimJob);
  }

  private static void checkHadoopJobWasKilled(Job victimJob) throws Exception {
    JobStatus status = JobStatus.UNKNOWN;
    // wait for the job status to be updated...
    for (int i = 0; i < 5 && !status.isFinished(); i++) {
      Thread.sleep(1000 * 5);
      status = JobUtils.getStatus(victimJob);
    }
    JobStatus status2 = JobUtils.getStatus(victimJob);
    assertTrue("job not killed - " + status2, (JobStatus.KILLED == status2 || JobStatus.FAILED == status2));
    assertTrue(status.isFinished());
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.hadoop.mapreduce.JobUtils.JobStatus

Copyright © 2018 www.massapicom. 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.