@Override public void execute(JobStatusUpdater statusUpdater, JobSuite suite) { double commandCount = systemCommands.length; double commandsRan = statusUpdater.getProperties().getDouble("ran", 0d); for (int i = (int) commandsRan; i < commandCount; i++) { SystemCommand systemCommand = systemCommands[i]; if (LOG.isDebugEnabled()) { LOG.debug("Executing command: " + systemCommand); } statusUpdater.setNote("Executing: " + systemCommand); try { systemCommand.execute(); statusUpdater.setProgress(commandsRan / commandCount); } catch (SystemCommandException e) { throw new JobException("Cannot execute command: " + systemCommand, e); } } statusUpdater.setNote("Done."); }
@Override public void mapChanged(MapChangeEvent<String, List<String>> event) { statusUpdated(status); } });
public synchronized void childStatusChanged(IJobStatus status) { int jobIndex = jobIds.indexOf(status.getJobId()); if (jobIndex >= 0) { completionRatios[jobIndex] = status.getProgress(); } // Compute average double ratioTotal = 0; int completedCount = 0; for (int i = 0; i < completionRatios.length; i++) { if (completionRatios[i] >= 1.0d) { completedCount++; } ratioTotal += completionRatios[i]; } statusUpdater.setProgress(Math.min(1.0d, (ratioTotal / jobs.length))); statusUpdater.setNote(completedCount + " of " + jobs.length + " jobs completed."); }
@Override public void execute(JobStatusUpdater statusUpdater, JobSuite suite) { IJobStatus status = suite.getJobStatus(statusUpdater.getJobId()); if (!status.isResumed()) { startExecution(statusUpdater, suite); } else if (!status.isCompleted()) { resumeExecution(statusUpdater, suite); } }
.doubleValue(); statusUpdater.setProgress(progress); statusUpdater.setNote( NumberFormat.getIntegerInstance().format(processed) + " references processed out of "
@Override public void run() { JobSuite.setCurrentJobId(statusUpdater.getJobId()); try { while (!isStopped()) { try { if (!processNextReference(statusUpdater, new ImporterPipelineContext( importerContextPrototype))) { break; } } catch (Exception e) { LOG.fatal(getId() + ": " + "An error occured that could compromise " + "the stability of the crawler. Stopping " + "excution to avoid further issues...", e); stop(suite.getJobStatus(suite.getRootJob()), suite); } } } catch (Exception e) { LOG.error(getId() + ": Problem in thread execution.", e); } finally { latch.countDown(); } } }
public void setProgress(double progress) { status.setProgress(progress); statusUpdated(status); } public void incrementProgress(double increment) {
public void setNote(String note) { status.setNote(note); statusUpdated(status); }
public void incrementProgress(double increment) { status.setProgress(status.getProgress() + increment); statusUpdated(status); } public long getDuration() {