Examples of TaskCancelResult


Examples of eu.stratosphere.nephele.taskmanager.TaskCancelResult

   * the respective flag and repeats the cancel request.
   */
  private void checkCancelRequestedFlag() {

    if (this.cancelRequested.compareAndSet(true, false)) {
      final TaskCancelResult tsr = cancelTask();
      if (tsr.getReturnCode() != AbstractTaskResult.ReturnCode.SUCCESS
        && tsr.getReturnCode() != AbstractTaskResult.ReturnCode.TASK_NOT_FOUND) {
        LOG.error("Unable to cancel vertex " + this + ": " + tsr.getReturnCode().toString()
          + ((tsr.getDescription() != null) ? (" (" + tsr.getDescription() + ")") : ""));
      }
    }
  }
View Full Code Here

Examples of eu.stratosphere.nephele.taskmanager.TaskCancelResult

    while (true) {

      final ExecutionState previousState = this.executionState.get();

      if (previousState == ExecutionState.CANCELED) {
        return new TaskCancelResult(getID(), AbstractTaskResult.ReturnCode.SUCCESS);
      }

      if (previousState == ExecutionState.FAILED) {
        return new TaskCancelResult(getID(), AbstractTaskResult.ReturnCode.SUCCESS);
      }

      if (previousState == ExecutionState.FINISHED) {
        return new TaskCancelResult(getID(), AbstractTaskResult.ReturnCode.SUCCESS);
      }

      // The vertex has already received a cancel request
      if (previousState == ExecutionState.CANCELING) {
        return new TaskCancelResult(getID(), ReturnCode.SUCCESS);
      }

      // Do not trigger the cancel request when vertex is in state STARTING, this might cause a race between RPC
      // calls.
      if (previousState == ExecutionState.STARTING) {

        this.cancelRequested.set(true);

        // We had a race, so we unset the flag and take care of cancellation ourselves
        if (this.executionState.get() != ExecutionState.STARTING) {
          this.cancelRequested.set(false);
          continue;
        }

        return new TaskCancelResult(getID(), AbstractTaskResult.ReturnCode.SUCCESS);
      }

      // Check if we had a race. If state change is accepted, send cancel request
      if (compareAndUpdateExecutionState(previousState, ExecutionState.CANCELING)) {

        if (this.groupVertex.getStageNumber() != this.executionGraph.getIndexOfCurrentExecutionStage()) {
          // Set to canceled directly
          updateExecutionState(ExecutionState.CANCELED, null);
          return new TaskCancelResult(getID(), AbstractTaskResult.ReturnCode.SUCCESS);
        }

        if (previousState != ExecutionState.RUNNING && previousState != ExecutionState.FINISHING) {
          // Set to canceled directly
          updateExecutionState(ExecutionState.CANCELED, null);
          return new TaskCancelResult(getID(), AbstractTaskResult.ReturnCode.SUCCESS);
        }

        final AllocatedResource ar = this.allocatedResource.get();

        if (ar == null) {
          final TaskCancelResult result = new TaskCancelResult(getID(),
            AbstractTaskResult.ReturnCode.NO_INSTANCE);
          result.setDescription("Assigned instance of vertex " + this.toString() + " is null!");
          return result;
        }

        try {
          return ar.getInstance().cancelTask(this.vertexID);

        } catch (IOException e) {
          final TaskCancelResult result = new TaskCancelResult(getID(),
            AbstractTaskResult.ReturnCode.IPC_ERROR);
          result.setDescription(StringUtils.stringifyException(e));
          return result;
        }
      }
    }
  }
View Full Code Here

Examples of eu.stratosphere.nephele.taskmanager.TaskCancelResult

    final Runnable cancelJobRunnable = new Runnable() {

      @Override
      public void run() {
        eg.updateJobStatus(InternalJobStatus.CANCELING, "Job canceled by user");
        final TaskCancelResult cancelResult = cancelJob(eg);
        if (cancelResult != null) {
          LOG.error(cancelResult.getDescription());
        }
      }
    };

    eg.executeCommand(cancelJobRunnable);
View Full Code Here

Examples of eu.stratosphere.nephele.taskmanager.TaskCancelResult

   * @return <code>null</code> if no error occurred during the cancel attempt,
   *         otherwise the returned object will describe the error
   */
  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;
View Full Code Here

Examples of eu.stratosphere.nephele.taskmanager.TaskCancelResult

          continue;
        }

        LOG.info(vertex + " is canceled by recovery logic");
        verticesToBeRestarted.put(vertex.getID(), vertex);
        final TaskCancelResult cancelResult = vertex.cancelTask();

        if (cancelResult.getReturnCode() != AbstractTaskResult.ReturnCode.SUCCESS
            && cancelResult.getReturnCode() != AbstractTaskResult.ReturnCode.TASK_NOT_FOUND) {

          verticesToBeRestarted.remove(vertex.getID());
          LOG.error("Unable to cancel vertex" + cancelResult.getDescription());
          return false;
        }
      }

      LOG.info("Starting cache invalidation");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.