List of usage examples for org.apache.hadoop.mapreduce Job isComplete
public boolean isComplete() throws IOException
From source file:weka.distributed.hadoop.HadoopJob.java
License:Open Source License
/** * Runs the supplied job/*from w w w . ja v a 2 s . c o m*/ * * @param job the job to run * @return true if the job was successful * @throws DistributedWekaException if a problem occurs */ protected boolean runJob(Job job) throws DistributedWekaException { try { m_stopRunningJob = false; if (DistributedJobConfig.isEmpty(getLoggingInterval())) { m_loggingInterval = "10"; } int logInterval = Integer.parseInt(m_loggingInterval); System.out.println("Setting logging interval to " + logInterval); job.submit(); try { int taskCompletionEventIndex = 0; while (!m_stopRunningJob && !job.isComplete()) { if (logInterval >= 1) { printJobStatus(job); taskCompletionEventIndex += logTaskMessages(job, taskCompletionEventIndex); Thread.sleep(logInterval * 1000); } else { Thread.sleep(60000); } } } catch (InterruptedException ie) { logMessage(ie.getMessage()); m_stopRunningJob = true; } if (m_stopRunningJob && !job.isComplete()) { job.killJob(); } m_stopRunningJob = false; return job.isSuccessful(); } catch (Exception ex) { throw new DistributedWekaException(ex); } }