Package org.apache.flink.runtime.taskmanager

Examples of org.apache.flink.runtime.taskmanager.TaskOperationResult


      final AllocatedSlot slot = instance.allocateSlot(new JobID());
     
      final ExecutionJobVertex ejv = getJobVertexExecutingAsynchronously(jid);
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
     
      when(taskManager.submitTask(Matchers.any(TaskDeploymentDescriptor.class))).thenReturn(new TaskOperationResult(vertex.getCurrentExecutionAttempt().getAttemptId(), false, ERROR_MESSAGE));
     
      assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
     
      vertex.deployToSlot(slot);
     
View Full Code Here


     
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
      final ExecutionAttemptID eid = vertex.getCurrentExecutionAttempt().getAttemptId();
     
      // the deployment call succeeds regularly
      when(taskManager.submitTask(any(TaskDeploymentDescriptor.class))).thenReturn(new TaskOperationResult(eid, true));
     
      // first cancel call does not find a task, second one finds it
      when(taskManager.cancelTask(any(ExecutionAttemptID.class))).thenReturn(
          new TaskOperationResult(eid, false), new TaskOperationResult(eid, true));
     
      assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
     
      vertex.deployToSlot(slot);
      assertEquals(ExecutionState.DEPLOYING, vertex.getExecutionState());
View Full Code Here

        @Override
        public void run() {
          try {
            Instance instance = slot.getInstance();

            TaskOperationResult result = instance.getTaskManagerProxy().submitTask(deployment);
            if (result == null) {
              markFailed(new Exception("Failed to deploy the task to slot " + slot + ": TaskOperationResult was null"));
            }
            else if (!result.getExecutionId().equals(attemptId)) {
              markFailed(new Exception("Answer execution id does not match the request execution id."));
            }
            else if (result.isSuccess()) {
              switchToRunning();
            }
            else {
              // deployment failed :(
              markFailed(new Exception("Failed to deploy the task " + getVertexWithAttempt() + " to slot " + slot + ": " + result.getDescription()));
            }
          }
          catch (Throwable t) {
            // some error occurred. fail the task
            markFailed(t);
View Full Code Here

        for (int triesLeft = NUM_CANCEL_CALL_TRIES; triesLeft > 0; --triesLeft) {
         
          try {
            // send the call. it may be that the task is not really there (asynchronous / overtaking messages)
            // in which case it is fine (the deployer catches it)
            TaskOperationResult result = slot.getInstance().getTaskManagerProxy().cancelTask(attemptId);
           
            if (!result.isSuccess()) {
              // the task was not found, which may be when the task concurrently finishes or fails, or
              // when the cancel call overtakes the deployment call
              if (LOG.isDebugEnabled()) {
                LOG.debug("Cancel task call did not find task. Probably RPC call race.");
              }
View Full Code Here

   
    when(top.submitTask(any(TaskDeploymentDescriptor.class))).thenAnswer(new Answer<TaskOperationResult>() {
      @Override
      public TaskOperationResult answer(InvocationOnMock invocation) {
        final TaskDeploymentDescriptor tdd = (TaskDeploymentDescriptor) invocation.getArguments()[0];
        return new TaskOperationResult(tdd.getExecutionId(), true);
      }
    });
   
    when(top.cancelTask(Matchers.any(ExecutionAttemptID.class))).thenAnswer(new Answer<TaskOperationResult>() {
      @Override
      public TaskOperationResult answer(InvocationOnMock invocation) {
        final ExecutionAttemptID id = (ExecutionAttemptID) invocation.getArguments()[0];
        return new TaskOperationResult(id, true);
      }
    });
   
    return top;
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.taskmanager.TaskOperationResult

Copyright © 2018 www.massapicom. 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.