/** * Returns the current {@link State} of the <code>Run</code>. * * A <code>Run</code>'s state can be CREATED, RUNNING, COMPLETED, PAUSED, * CANCELLED or FAILED. * * @return the current <code>State</code> of the <code>Run</code> */ public State getState() { return workflowReport.getState(); }
public void pause() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (!state.equals(RUNNING)) throw new RunStateException("Cannot pause a " + state + " run."); executionEnvironment.getExecutionService().pause(executionID); workflowReport.setPausedDate(new Date()); } }
public void resume() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (!state.equals(PAUSED)) throw new RunStateException("Cannot resume a " + state + " run."); executionEnvironment.getExecutionService().resume(executionID); workflowReport.setResumedDate(new Date()); } }
public void start() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (!state.equals(CREATED)) throw new RunStateException("Cannot start a " + state + " run."); executionEnvironment.getExecutionService().start(executionID); } }
@Override public String toString() { DateFormat dateFormat = new SimpleDateFormat(dateFormatString); StringBuilder sb = new StringBuilder(); int max = getLongestName(this, 0); spaces(sb, max + 1); sb.append("Status "); sb.append("Queued "); sb.append("Started "); sb.append("Complete "); sb.append("Errors "); sb.append("Started "); sb.append("Finished\n"); sb.append(getSubject().getName()); spaces(sb, max - getSubject().getName().length() + 1); sb.append(getState()); spaces(sb, 10 - getState().name().length()); sb.append("-"); spaces(sb, 9); sb.append("-"); spaces(sb, 9); sb.append("-"); spaces(sb, 9); sb.append("-"); spaces(sb, 9); addDates(sb, getStartedDate(), getCompletedDate(), dateFormat); for (ProcessorReport processorReport : getProcessorReports()) addProcessor(sb, max, 0, processorReport, dateFormat); return sb.toString(); }
public void cancel() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (state.equals(CANCELLED) || state.equals(COMPLETED) || state.equals(FAILED)) throw new RunStateException("Cannot cancel a " + state + " run."); executionEnvironment.getExecutionService().cancel(executionID); workflowReport.setCancelledDate(new Date()); } } }
try (Bundle bundle = DataBundles.openBundle(bundlePath)) { WorkflowReport wfReport = workflowReportJson.load(bundle); assertEquals(State.COMPLETED, wfReport.getState()); assertNull(wfReport.getParentReport());