Esempio n. 1
0
 public void onException(Throwable ex) {
   UKV.remove(dest());
   Value v = DKV.get(progressKey());
   if (v != null) {
     ChunkProgress p = v.get();
     p = p.error(ex.getMessage());
     DKV.put(progressKey(), p);
   }
   cancel(ex);
 }
Esempio n. 2
0
 /**
  * Signal exceptional cancellation of this job.
  *
  * @param ex exception causing the termination of job.
  */
 public void cancel(Throwable ex) {
   if (ex instanceof JobCancelledException
       || ex.getMessage() != null && ex.getMessage().contains("job was cancelled")) return;
   if (ex instanceof IllegalArgumentException
       || ex.getCause() instanceof IllegalArgumentException) {
     cancel("Illegal argument: " + ex.getMessage());
     return;
   }
   StringWriter sw = new StringWriter();
   PrintWriter pw = new PrintWriter(sw);
   ex.printStackTrace(pw);
   String stackTrace = sw.toString();
   cancel(
       "Got exception '" + ex.getClass() + "', with msg '" + ex.getMessage() + "'\n" + stackTrace,
       JobState.FAILED);
   if (_fjtask != null && !_fjtask.isDone()) _fjtask.completeExceptionally(ex);
 }