code: private TaskCancelResult cancelJob(final ExecutionGraph eg) {
  
  		TaskCancelResult errorResult = null;
  
  		/**
  		 * Cancel all nodes in the current and upper execution stages.
  		 */
  		final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(eg, eg.getIndexOfCurrentExecutionStage(),
  			false, true);
  		while (it.hasNext()) {
  
  			final ExecutionVertex vertex = it.next();
  			final TaskCancelResult result = vertex.cancelTask();
  			if (result.getReturnCode() != AbstractTaskResult.ReturnCode.SUCCESS) {
  				errorResult = result;
  			}
  		}
  
  		return errorResult;
  	}
docs: Cancels all the tasks in the current and upper stages of the
  given execution graph.
  
  @param eg
  the execution graph representing the job to cancel.
  @return <code>null</code> if no error occurred during the cancel attempt,
  otherwise the returned object will describe the error