@Override public MonitoredObject getRunningState() { return this.driver._jobState.getRunningState(); } }
@Override public boolean apply(JobExecutionState state) { return null != state.getRunningState() && state.getRunningState().equals(targetState); } @Override public String toString() {
@Override public boolean apply(@Nonnull JobExecutionState state) { return null != state.getRunningState() && state.getRunningState().isDone(); } @Override public String toString() {
public static JobExecutionResult createFromState(JobExecutionState state) { Preconditions.checkArgument(null != state.getRunningState()); Preconditions.checkArgument(state.getRunningState().isDone()); if (state.getRunningState().isSuccess()) { return JobExecutionResult.createSuccessResult(); } else if (state.getRunningState().isCancelled()) { return JobExecutionResult.createCancelledResult(); } else { // FIXME we need to capture error(s) return JobExecutionResult.createFailureResult( new RuntimeException("Gobblin job failed:" + state.getJobExecution())); } } }
@Override public void run() { try { jes1.awaitForDone(0); } catch (InterruptedException | TimeoutException e) { log.error("Error detected: " + e); } doneDetected.set(jes1.getRunningState().isDone()); } });
@Override public void onJobPrepare(JobContext jobContext) throws Exception { super.onJobPrepare(jobContext); _jobContext = jobContext; if (_jobState.getRunningState() == null) { _jobState.switchToPending(); } _jobState.switchToRunning(); if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsLaunched().inc(); } }
private void assertTransition(final JobExecutionState jes1, final JobExecutionStateListener listener, final RunningState fromState, final RunningState toState, final Logger log) throws TimeoutException, InterruptedException { jes1.setRunningState(toState); Assert.assertEquals(jes1.getRunningState(), toState); AssertWithBackoff.assertTrue(new Predicate<Void>() { @Override public boolean apply(Void input) { try { verify(listener).onStatusChange(eq(jes1), eq(fromState), eq(toState)); } catch (Throwable t) { // ignore } return true; } }, 50, "expecting state callback", log, 2.0, 10); }
Assert.assertEquals(jes1.getRunningState(), RunningState.RUNNING); } catch (TimeoutException e) { Assert.fail("Timeout: ");
@Override public MonitoredObject getRunningState() { return this.driver._jobState.getRunningState(); } }
@Override public boolean apply(JobExecutionState state) { return null != state.getRunningState() && state.getRunningState().equals(targetState); } @Override public String toString() {
@Override public boolean apply(@Nonnull JobExecutionState state) { return null != state.getRunningState() && state.getRunningState().isDone(); } @Override public String toString() {
public static JobExecutionResult createFromState(JobExecutionState state) { Preconditions.checkArgument(null != state.getRunningState()); Preconditions.checkArgument(state.getRunningState().isDone()); if (state.getRunningState().isSuccess()) { return JobExecutionResult.createSuccessResult(); } else if (state.getRunningState().isCancelled()) { return JobExecutionResult.createCancelledResult(); } else { // FIXME we need to capture error(s) return JobExecutionResult.createFailureResult( new RuntimeException("Gobblin job failed:" + state.getJobExecution())); } } }
@Override public void onJobPrepare(JobContext jobContext) throws Exception { super.onJobPrepare(jobContext); _jobContext = jobContext; if (_jobState.getRunningState() == null) { _jobState.switchToPending(); } _jobState.switchToRunning(); if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsLaunched().inc(); } }