Package org.apache.flink.runtime.protocols

Examples of org.apache.flink.runtime.protocols.TaskOperationProtocol.cancelTask()


      assertEquals(ExecutionState.SCHEDULED, vertex.getExecutionState());
     
      // task manager mock
      TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.submitTask(Matchers.any(TaskDeploymentDescriptor.class))).thenReturn(new TaskOperationResult(execId, true));
      when(taskManager.cancelTask(execId)).thenReturn(new TaskOperationResult(execId, true), new TaskOperationResult(execId, false));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());
     
      vertex.deployToSlot(slot);
View Full Code Here


      // task manager mock
      TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.submitTask(Matchers.any(TaskDeploymentDescriptor.class))).thenReturn(new TaskOperationResult(execId, true));
     
      // first return NOT SUCCESS (task not found, cancel call overtook deploy call), then success (cancel call after deploy call)
      when(taskManager.cancelTask(execId)).thenReturn(new TaskOperationResult(execId, false), new TaskOperationResult(execId, true));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());
     
      vertex.deployToSlot(slot);
View Full Code Here

     
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
      final ExecutionAttemptID execId = vertex.getCurrentExecutionAttempt().getAttemptId();

      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.cancelTask(execId)).thenReturn(new TaskOperationResult(execId, true));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());

      setVertexState(vertex, ExecutionState.RUNNING);
View Full Code Here

     
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
      final ExecutionAttemptID execId = vertex.getCurrentExecutionAttempt().getAttemptId();

      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.cancelTask(execId)).thenReturn(new TaskOperationResult(execId, true));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());

      setVertexState(vertex, ExecutionState.RUNNING);
View Full Code Here

     
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
      final ExecutionAttemptID execId = vertex.getCurrentExecutionAttempt().getAttemptId();

      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.cancelTask(execId)).thenReturn(new TaskOperationResult(execId, false));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());

      setVertexState(vertex, ExecutionState.RUNNING);
View Full Code Here

     
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
      final ExecutionAttemptID execId = vertex.getCurrentExecutionAttempt().getAttemptId();

      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.cancelTask(execId)).thenThrow(new IOException("RPC call failed"));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());

      setVertexState(vertex, ExecutionState.RUNNING);
View Full Code Here

     
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
      final ExecutionAttemptID execId = vertex.getCurrentExecutionAttempt().getAttemptId();

      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.cancelTask(execId)).thenThrow(new IOException("RPC call failed"));
     
      Instance instance = getInstance(taskManager);
      AllocatedSlot slot = instance.allocateSlot(new JobID());

      setVertexState(vertex, ExecutionState.RUNNING);
View Full Code Here

      public TaskOperationResult answer(InvocationOnMock invocation) {
        final TaskDeploymentDescriptor tdd = (TaskDeploymentDescriptor) invocation.getArguments()[0];
        return new TaskOperationResult(tdd.getExecutionId(), true);
      }
    });
    when(taskManager.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);
      }
View Full Code Here

     
      // 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);
View Full Code Here

        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);
      }
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.