private void cancel(final String msg, JobState resultingState) { if (resultingState == JobState.CANCELLED) { Log.info("Job " + self() + "(" + description + ") was cancelled."); } else { Log.err("Job " + self() + "(" + description + ") failed."); Log.err(msg); } exception = msg; state = resultingState; // replace finished job by a job handle replaceByJobHandle(); DKV.write_barrier(); final Job job = this; H2O.submitTask( new H2OCountedCompleter() { @Override public void compute2() { job.onCancelled(); } }); }
/** * Forks computation of this job. * * <p>The call does not block. * * @return always returns this job. */ public Job fork() { init(); H2OCountedCompleter task = new H2OCountedCompleter() { @Override public void compute2() { try { try { // Exec always waits till the end of computation Job.this.exec(); Job.this.remove(); } catch (Throwable t) { if (!(t instanceof ExpectedExceptionForDebug)) Log.err(t); Job.this.cancel(t); } } finally { tryComplete(); } } }; start(task); H2O.submitTask(task); return this; }
/** * Cross-Validate this Job (to be overridden for each instance, which also calls * genericCrossValidation) * * @param splits Frames containing train/test splits * @param cv_preds Store the predictions for each cross-validation run * @param offsets Array to store the offsets of starting row indices for each cross-validation * run * @param i Which fold of cross-validation to perform */ public void crossValidate(Frame[] splits, Frame[] cv_preds, long[] offsets, int i) { throw H2O.unimpl(); }