Search in sources :

Example 66 with ExecutionVertexID

use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.

the class DefaultSchedulingPipelinedRegionTest method returnsVertices.

@Test
public void returnsVertices() {
    final DefaultExecutionVertex vertex = new DefaultExecutionVertex(new ExecutionVertexID(new JobVertexID(), 0), Collections.emptyList(), () -> ExecutionState.CREATED, Collections.emptyList(), partitionID -> {
        throw new UnsupportedOperationException();
    });
    final Set<DefaultExecutionVertex> vertices = Collections.singleton(vertex);
    final Map<IntermediateResultPartitionID, DefaultResultPartition> resultPartitionById = Collections.emptyMap();
    final DefaultSchedulingPipelinedRegion pipelinedRegion = new DefaultSchedulingPipelinedRegion(vertices, resultPartitionById::get);
    final Iterator<DefaultExecutionVertex> vertexIterator = pipelinedRegion.getVertices().iterator();
    assertThat(vertexIterator.hasNext(), is(true));
    assertThat(vertexIterator.next(), is(sameInstance(vertex)));
    assertThat(vertexIterator.hasNext(), is(false));
}
Also used : ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) Test(org.junit.Test)

Example 67 with ExecutionVertexID

use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.

the class TestExecutionSlotAllocator method createSlotVertexAssignments.

private List<SlotExecutionVertexAssignment> createSlotVertexAssignments(final Collection<ExecutionVertexID> executionVertexIds) {
    final List<SlotExecutionVertexAssignment> result = new ArrayList<>();
    for (ExecutionVertexID executionVertexId : executionVertexIds) {
        final CompletableFuture<LogicalSlot> logicalSlotFuture = new CompletableFuture<>();
        result.add(new SlotExecutionVertexAssignment(executionVertexId, logicalSlotFuture));
    }
    return result;
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) ArrayList(java.util.ArrayList) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot)

Example 68 with ExecutionVertexID

use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.

the class DefaultExecutionTopologyTest method testExistingRegionsAreNotAffectedDuringTopologyUpdate.

@Test
public void testExistingRegionsAreNotAffectedDuringTopologyUpdate() throws Exception {
    final JobVertex[] jobVertices = createJobVertices(BLOCKING);
    executionGraph = createDynamicGraph(jobVertices);
    adapter = DefaultExecutionTopology.fromExecutionGraph(executionGraph);
    final ExecutionJobVertex ejv1 = executionGraph.getJobVertex(jobVertices[0].getID());
    final ExecutionJobVertex ejv2 = executionGraph.getJobVertex(jobVertices[1].getID());
    executionGraph.initializeJobVertex(ejv1, 0L);
    adapter.notifyExecutionGraphUpdated(executionGraph, Collections.singletonList(ejv1));
    SchedulingPipelinedRegion regionOld = adapter.getPipelinedRegionOfVertex(new ExecutionVertexID(ejv1.getJobVertexId(), 0));
    executionGraph.initializeJobVertex(ejv2, 0L);
    adapter.notifyExecutionGraphUpdated(executionGraph, Collections.singletonList(ejv2));
    SchedulingPipelinedRegion regionNew = adapter.getPipelinedRegionOfVertex(new ExecutionVertexID(ejv1.getJobVertexId(), 0));
    assertSame(regionOld, regionNew);
}
Also used : JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) SchedulingPipelinedRegion(org.apache.flink.runtime.scheduler.strategy.SchedulingPipelinedRegion) Test(org.junit.Test)

Example 69 with ExecutionVertexID

use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.

the class DefaultExecutionTopologyTest method testGetVertexOrThrow.

@Test
public void testGetVertexOrThrow() {
    try {
        adapter.getVertex(new ExecutionVertexID(new JobVertexID(), 0));
        fail("get not exist vertex");
    } catch (IllegalArgumentException exception) {
    // expected
    }
}
Also used : ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) Test(org.junit.Test)

Example 70 with ExecutionVertexID

use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.

the class DefaultResultPartitionTest method testGetConsumerVertexGroup.

@Test
public void testGetConsumerVertexGroup() {
    assertFalse(resultPartition.getConsumerVertexGroup().isPresent());
    // test update consumers
    ExecutionVertexID executionVertexId = new ExecutionVertexID(new JobVertexID(), 0);
    consumerVertexGroups.put(resultPartition.getId(), ConsumerVertexGroup.fromSingleVertex(executionVertexId));
    assertTrue(resultPartition.getConsumerVertexGroup().isPresent());
    assertThat(resultPartition.getConsumerVertexGroup().get(), contains(executionVertexId));
}
Also used : ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) Test(org.junit.Test)

Aggregations

ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)231 Test (org.junit.Test)165 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)63 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)57 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)54 SchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex)51 Set (java.util.Set)48 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)45 AdaptiveSchedulerTest (org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest)45 TestingSchedulingExecutionVertex (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingExecutionVertex)45 Collection (java.util.Collection)33 TestingSchedulingTopology (org.apache.flink.runtime.scheduler.strategy.TestingSchedulingTopology)33 HashSet (java.util.HashSet)30 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)30 ArrayList (java.util.ArrayList)27 Map (java.util.Map)27 HashMap (java.util.HashMap)24 List (java.util.List)24 CompletableFuture (java.util.concurrent.CompletableFuture)24 TaskManagerLocation (org.apache.flink.runtime.taskmanager.TaskManagerLocation)24