Package org.apache.flink.runtime.jobgraph

Examples of org.apache.flink.runtime.jobgraph.JobID


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


      // deploying after canceling from CREATED needs to raise an exception, because
      // the scheduler (or any caller) needs to know that the slot should be released
      try {
        TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
        Instance instance = getInstance(taskManager);
        AllocatedSlot slot = instance.allocateSlot(new JobID());
       
        vertex.deployToSlot(slot);
        fail("Method should throw an exception");
      }
      catch (IllegalStateException e) {
View Full Code Here

        ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
        setVertexState(vertex, ExecutionState.CANCELING);
       
        TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
        Instance instance = getInstance(taskManager);
        AllocatedSlot slot = instance.allocateSlot(new JobID());
       
        vertex.deployToSlot(slot);
        fail("Method should throw an exception");
      }
      catch (IllegalStateException e) {}
     
     
      // fail while canceling
      {
        ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
       
        TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
        Instance instance = getInstance(taskManager);
        AllocatedSlot slot = instance.allocateSlot(new JobID());
       
        setVertexResource(vertex, slot);
        setVertexState(vertex, ExecutionState.CANCELING);
       
        Exception failureCause = new Exception("test exception");
View Full Code Here

  }
 
 
  public static Execution getDummyTask() {
    ExecutionVertex vertex = mock(ExecutionVertex.class);
    when(vertex.getJobId()).thenReturn(new JobID());
    when(vertex.toString()).thenReturn("TEST-VERTEX");
   
    Execution execution = mock(Execution.class);
    when(execution.getVertex()).thenReturn(vertex);
   
View Full Code Here

 
  public static Execution getTestVertex(Iterable<Instance> preferredLocations) {
    ExecutionVertex vertex = mock(ExecutionVertex.class);
   
    when(vertex.getPreferredLocations()).thenReturn(preferredLocations);
    when(vertex.getJobId()).thenReturn(new JobID());
    when(vertex.toString()).thenReturn("TEST-VERTEX");
   
    Execution execution = mock(Execution.class);
    when(execution.getVertex()).thenReturn(vertex);
   
View Full Code Here

 
  public static Execution getTestVertex(JobVertexID jid, int taskIndex, int numTasks) {
    ExecutionVertex vertex = mock(ExecutionVertex.class);
   
    when(vertex.getPreferredLocations()).thenReturn(null);
    when(vertex.getJobId()).thenReturn(new JobID());
    when(vertex.getJobvertexId()).thenReturn(jid);
    when(vertex.getParallelSubtaskIndex()).thenReturn(taskIndex);
    when(vertex.getTotalNumberOfParallelSubtasks()).thenReturn(numTasks);
    when(vertex.toString()).thenReturn("TEST-VERTEX");
    when(vertex.getSimpleName()).thenReturn("TEST-VERTEX");
View Full Code Here

 
  public static Execution getTestVertexWithLocation(JobVertexID jid, int taskIndex, int numTasks, Instance... locations) {
    ExecutionVertex vertex = mock(ExecutionVertex.class);
   
    when(vertex.getPreferredLocations()).thenReturn(Arrays.asList(locations));
    when(vertex.getJobId()).thenReturn(new JobID());
    when(vertex.getJobvertexId()).thenReturn(jid);
    when(vertex.getParallelSubtaskIndex()).thenReturn(taskIndex);
    when(vertex.getTotalNumberOfParallelSubtasks()).thenReturn(numTasks);
    when(vertex.toString()).thenReturn("TEST-VERTEX");
   
View Full Code Here

        fail();
      } catch (IllegalStateException e) {
        // expected
      }
     
      final AllocatedSlot slot1 = new AllocatedSlot(new JobID(), SchedulerTestUtils.getRandomInstance(1), 0);
      final AllocatedSlot slot2 = new AllocatedSlot(new JobID(), SchedulerTestUtils.getRandomInstance(1), 0);
     
      future.setSlot(slot1);
      try {
        future.setSlot(slot2);
        fail();
View Full Code Here

    try {
     
      // action before the slot
      {
        final AtomicInteger invocations = new AtomicInteger();
        final AllocatedSlot thisSlot = new AllocatedSlot(new JobID(), SchedulerTestUtils.getRandomInstance(1), 0);
       
        SlotAllocationFuture future = new SlotAllocationFuture();
       
        future.setFutureAction(new SlotAllocationFutureAction() {
          @Override
          public void slotAllocated(AllocatedSlot slot) {
            assertEquals(thisSlot, slot);
            invocations.incrementAndGet();
          }
        });
       
        future.setSlot(thisSlot);
       
        assertEquals(1, invocations.get());
      }
     
      // slot before action
      {
        final AtomicInteger invocations = new AtomicInteger();
        final AllocatedSlot thisSlot = new AllocatedSlot(new JobID(), SchedulerTestUtils.getRandomInstance(1), 0);
       
        SlotAllocationFuture future = new SlotAllocationFuture();
        future.setSlot(thisSlot);
       
        future.setFutureAction(new SlotAllocationFutureAction() {
View Full Code Here

      // sync before setting the slot
      {
        final AtomicInteger invocations = new AtomicInteger();
        final AtomicBoolean error = new AtomicBoolean();
       
        final AllocatedSlot thisSlot = new AllocatedSlot(new JobID(), SchedulerTestUtils.getRandomInstance(1), 0);
       
        final SlotAllocationFuture future = new SlotAllocationFuture();
       
       
        Runnable r = new Runnable() {
          @Override
          public void run() {
            try {
              AllocatedSlot syncSlot = future.waitTillAllocated();
              if (syncSlot == null || syncSlot != thisSlot) {
                error.set(true);
                return;
              }
              invocations.incrementAndGet();
            }
            catch (Throwable t) {
              error.set(true);
            }
          }
        };
       
        Thread syncer = new Thread(r);
        syncer.start();
       
        // wait, and give the sync thread a chance to sync
        Thread.sleep(10);
        future.setSlot(thisSlot);
       
        syncer.join();
       
        assertFalse(error.get());
        assertEquals(1, invocations.get());
      }
     
      // setting slot before syncing
      {
        final AllocatedSlot thisSlot = new AllocatedSlot(new JobID(), SchedulerTestUtils.getRandomInstance(1), 0);
        final SlotAllocationFuture future = new SlotAllocationFuture();

        future.setSlot(thisSlot);
       
        AllocatedSlot retrieved = future.waitTillAllocated();
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.jobgraph.JobID

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.