Package org.apache.flink.runtime.deployment

Examples of org.apache.flink.runtime.deployment.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);
        }
      });
     
      final Instance instance = getInstance(taskManager);
      final AllocatedSlot slot = instance.allocateSlot(jobId);
     
      assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
     
      vertex.deployToSlot(slot);
     
      assertEquals(ExecutionState.RUNNING, vertex.getExecutionState());
     
      TaskDeploymentDescriptor descr = reference.get();
      assertNotNull(descr);
     
      assertEquals(jobId, descr.getJobID());
      assertEquals(jid2, descr.getVertexID());
      assertEquals(3, descr.getIndexInSubtaskGroup());
      assertEquals(10, descr.getCurrentNumberOfSubtasks());
      assertEquals(RegularPactTask.class.getName(), descr.getInvokableClassName());
      assertEquals("v2", descr.getTaskName());
     
      assertEquals(2, descr.getOutputGates().size());
      assertEquals(1, descr.getInputGates().size());
     
      assertEquals(10, descr.getOutputGates().get(0).getChannels().size());
      assertEquals(10, descr.getOutputGates().get(1).getChannels().size());
      assertEquals(10, descr.getInputGates().get(0).getChannels().size());
    }
    catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
View Full Code Here


    // 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);
      }
    });
    when(taskManager.cancelTask(Matchers.any(ExecutionAttemptID.class))).thenAnswer(new Answer<TaskOperationResult>() {
      @Override
      public TaskOperationResult answer(InvocationOnMock invocation) {
View Full Code Here

      if (LOG.isInfoEnabled()) {
        LOG.info(String.format("Deploying %s (attempt #%d) to %s", vertex.getSimpleName(),
            attemptNumber, slot.getInstance().getInstanceConnectionInfo().getHostname()));
      }
     
      final TaskDeploymentDescriptor deployment = vertex.createDeploymentDescriptor(attemptId, slot);
     
      // register this execution at the execution graph, to receive call backs
      vertex.getExecutionGraph().registerExecution(this);
     
      // we execute the actual deploy call in a concurrent action to prevent this call from blocking for long
View Full Code Here

      }
    }
   
    List<BlobKey> jarFiles = getExecutionGraph().getRequiredJarFiles();
   
    return new TaskDeploymentDescriptor(getJobId(), getJobvertexId(), executionId, getTaskName(),
        subTaskIndex, getTotalNumberOfParallelSubtasks(),
        getExecutionGraph().getJobConfiguration(), jobVertex.getJobVertex().getConfiguration(),
        jobVertex.getJobVertex().getInvokableClassName(), outputGates, inputGates, jarFiles, slot.getSlotNumber());
  }
View Full Code Here

      final JobVertexID vid = new JobVertexID();
      final ExecutionAttemptID eid = new ExecutionAttemptID();
     
      final TaskManager taskManager = mock(TaskManager.class);
     
      TaskDeploymentDescriptor tdd = new TaskDeploymentDescriptor(jid, vid, eid, "TestTask", 2, 7,
          new Configuration(), new Configuration(), TestInvokableCorrect.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
     
View Full Code Here

      final JobVertexID vid = new JobVertexID();
      final ExecutionAttemptID eid = new ExecutionAttemptID();
     
      final TaskManager taskManager = mock(TaskManager.class);
     
      TaskDeploymentDescriptor tdd = new TaskDeploymentDescriptor(jid, vid, eid, "TestTask", 2, 7,
          new Configuration(), new Configuration(), TestInvokableWithException.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
     
View Full Code Here

      JobID jid = new JobID();
      JobVertexID vid = new JobVertexID();
      ExecutionAttemptID eid = new ExecutionAttemptID();
     
      TaskDeploymentDescriptor tdd = new TaskDeploymentDescriptor(jid, vid, eid, "TestTask", 2, 7,
          new Configuration(), new Configuration(), TestInvokableCorrect.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
     
View Full Code Here

      JobVertexID vid2 = new JobVertexID();
     
      ExecutionAttemptID eid1 = new ExecutionAttemptID();
      ExecutionAttemptID eid2 = new ExecutionAttemptID();
     
      TaskDeploymentDescriptor tdd1 = new TaskDeploymentDescriptor(jid1, vid1, eid1, "TestTask1", 1, 5,
          new Configuration(), new Configuration(), TestInvokableBlockingCancelable.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
     
      TaskDeploymentDescriptor tdd2 = new TaskDeploymentDescriptor(jid2, vid2, eid2, "TestTask2", 2, 7,
          new Configuration(), new Configuration(), TestInvokableBlockingCancelable.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
View Full Code Here

      JobVertexID vid2 = new JobVertexID();
     
      ExecutionAttemptID eid1 = new ExecutionAttemptID();
      ExecutionAttemptID eid2 = new ExecutionAttemptID();
     
      TaskDeploymentDescriptor tdd1 = new TaskDeploymentDescriptor(jid, vid1, eid1, "Sender", 0, 1,
          new Configuration(), new Configuration(), Sender.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
     
      TaskDeploymentDescriptor tdd2 = new TaskDeploymentDescriptor(jid, vid2, eid2, "Receiver", 2, 7,
          new Configuration(), new Configuration(), Receiver.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
View Full Code Here

     
      tm = createTaskManager(jobManager);
     
      ChannelDeploymentDescriptor cdd = new ChannelDeploymentDescriptor(senderId, receiverId);
     
      TaskDeploymentDescriptor tdd1 = new TaskDeploymentDescriptor(jid, vid1, eid1, "Sender", 0, 1,
          new Configuration(), new Configuration(), Sender.class.getName(),
          Collections.singletonList(new GateDeploymentDescriptor(Collections.singletonList(cdd))),
          Collections.<GateDeploymentDescriptor>emptyList(),
          new ArrayList<BlobKey>(), 0);
     
      TaskDeploymentDescriptor tdd2 = new TaskDeploymentDescriptor(jid, vid2, eid2, "Receiver", 2, 7,
          new Configuration(), new Configuration(), Receiver.class.getName(),
          Collections.<GateDeploymentDescriptor>emptyList(),
          Collections.singletonList(new GateDeploymentDescriptor(Collections.singletonList(cdd))),
          new ArrayList<BlobKey>(), 0);
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.deployment.TaskDeploymentDescriptor

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.