Package org.apache.flink.runtime.protocols

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


      setVertexState(vertex, ExecutionState.SCHEDULED);
      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());
     
View Full Code Here


      setVertexState(vertex, ExecutionState.SCHEDULED);
      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));
     
      // 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);
View Full Code Here

      // just some reference (needs not be atomic)
      final AtomicReference<TaskDeploymentDescriptor> reference = new AtomicReference<TaskDeploymentDescriptor>();
     
      // mock taskmanager to simply accept the call
      TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      when(taskManager.submitTask(Matchers.any(TaskDeploymentDescriptor.class))).thenAnswer(new Answer<TaskOperationResult>() {
        @Override
        public TaskOperationResult answer(InvocationOnMock invocation) {
          final TaskDeploymentDescriptor tdd = (TaskDeploymentDescriptor) invocation.getArguments()[0];
          reference.set(tdd);
          return new TaskOperationResult(tdd.getExecutionId(), true);
View Full Code Here

    List<AbstractJobVertex> ordered = Arrays.asList(v1, v2);
    eg.attachJobGraph(ordered);
   
    // create a mock taskmanager that accepts deployment calls
    TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
    when(taskManager.submitTask(Matchers.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);
      }
View Full Code Here

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

      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(), true));
     
      assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
     
      vertex.deployToSlot(slot);
     
View Full Code Here

     
      final ExecutionJobVertex ejv = getJobVertexExecutingSynchronously(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 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));
     
View Full Code Here

  }
 
  public static TaskOperationProtocol getSimpleAcknowledgingTaskmanager() throws Exception {
    TaskOperationProtocol top = mock(TaskOperationProtocol.class);
   
    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);
      }
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.