[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r414313732 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategy.java ## @@ -84,34 +77,8 @@ public RestartPipelinedRegionFailoverStrategy( ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker) { this.topology = checkNotNull(topology); - this.regions = Collections.newSetFromMap(new IdentityHashMap<>()); - this.vertexToRegionMap = new HashMap<>(); this.resultPartitionAvailabilityChecker = new RegionFailoverResultPartitionAvailabilityChecker( resultPartitionAvailabilityChecker); - - // build regions based on the given topology - LOG.info("Start building failover regions."); - buildFailoverRegions(); - } - // - // region building - // - - private void buildFailoverRegions() { - final Set> distinctRegions = - PipelinedRegionComputeUtil.computePipelinedRegions(topology); - - // creating all the failover regions and register them - for (Set regionVertices : distinctRegions) { - LOG.debug("Creating a failover region with {} vertices.", regionVertices.size()); - final FailoverRegion failoverRegion = new FailoverRegion(regionVertices); - regions.add(failoverRegion); - for (SchedulingExecutionVertex vertex : regionVertices) { - vertexToRegionMap.put(vertex.getId(), failoverRegion); - } - } - - LOG.info("Created {} failover regions.", regions.size()); Review comment: Ok makes sense. Changed to info. ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategy.java ## @@ -84,34 +77,8 @@ public RestartPipelinedRegionFailoverStrategy( ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker) { this.topology = checkNotNull(topology); - this.regions = Collections.newSetFromMap(new IdentityHashMap<>()); - this.vertexToRegionMap = new HashMap<>(); this.resultPartitionAvailabilityChecker = new RegionFailoverResultPartitionAvailabilityChecker( resultPartitionAvailabilityChecker); - - // build regions based on the given topology - LOG.info("Start building failover regions."); - buildFailoverRegions(); - } - // - // region building - // - - private void buildFailoverRegions() { - final Set> distinctRegions = - PipelinedRegionComputeUtil.computePipelinedRegions(topology); - - // creating all the failover regions and register them - for (Set regionVertices : distinctRegions) { - LOG.debug("Creating a failover region with {} vertices.", regionVertices.size()); - final FailoverRegion failoverRegion = new FailoverRegion(regionVertices); - regions.add(failoverRegion); - for (SchedulingExecutionVertex vertex : regionVertices) { - vertexToRegionMap.put(vertex.getId(), failoverRegion); - } - } - - LOG.info("Created {} failover regions.", regions.size()); Review comment: Ok makes sense. Changed to INFO. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r413977547 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategy.java ## @@ -84,34 +77,8 @@ public RestartPipelinedRegionFailoverStrategy( ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker) { this.topology = checkNotNull(topology); - this.regions = Collections.newSetFromMap(new IdentityHashMap<>()); - this.vertexToRegionMap = new HashMap<>(); this.resultPartitionAvailabilityChecker = new RegionFailoverResultPartitionAvailabilityChecker( resultPartitionAvailabilityChecker); - - // build regions based on the given topology - LOG.info("Start building failover regions."); - buildFailoverRegions(); - } - // - // region building - // - - private void buildFailoverRegions() { - final Set> distinctRegions = - PipelinedRegionComputeUtil.computePipelinedRegions(topology); - - // creating all the failover regions and register them - for (Set regionVertices : distinctRegions) { - LOG.debug("Creating a failover region with {} vertices.", regionVertices.size()); - final FailoverRegion failoverRegion = new FailoverRegion(regionVertices); - regions.add(failoverRegion); - for (SchedulingExecutionVertex vertex : regionVertices) { - vertexToRegionMap.put(vertex.getId(), failoverRegion); - } - } - - LOG.info("Created {} failover regions.", regions.size()); Review comment: Added logging (153983502e03705fa2496728c1ef76167a6fe68c). Wasn't sure about the previous log level. It's on DEBUG level now. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r413977547 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategy.java ## @@ -84,34 +77,8 @@ public RestartPipelinedRegionFailoverStrategy( ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker) { this.topology = checkNotNull(topology); - this.regions = Collections.newSetFromMap(new IdentityHashMap<>()); - this.vertexToRegionMap = new HashMap<>(); this.resultPartitionAvailabilityChecker = new RegionFailoverResultPartitionAvailabilityChecker( resultPartitionAvailabilityChecker); - - // build regions based on the given topology - LOG.info("Start building failover regions."); - buildFailoverRegions(); - } - // - // region building - // - - private void buildFailoverRegions() { - final Set> distinctRegions = - PipelinedRegionComputeUtil.computePipelinedRegions(topology); - - // creating all the failover regions and register them - for (Set regionVertices : distinctRegions) { - LOG.debug("Creating a failover region with {} vertices.", regionVertices.size()); - final FailoverRegion failoverRegion = new FailoverRegion(regionVertices); - regions.add(failoverRegion); - for (SchedulingExecutionVertex vertex : regionVertices) { - vertexToRegionMap.put(vertex.getId(), failoverRegion); - } - } - - LOG.info("Created {} failover regions.", regions.size()); Review comment: Added logging (153983502e03705fa2496728c1ef76167a6fe68c). Wasn't sure about the previous log level. It's on INFO level now. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r412893058 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/partitionrelease/RegionPartitionReleaseStrategy.java ## @@ -41,15 +39,13 @@ import static org.apache.flink.util.Preconditions.checkState; /** - * Releases blocking intermediate result partitions that are incident to a {@link PipelinedRegion}, + * Releases blocking intermediate result partitions that are incident to a {@link SchedulingPipelinedRegion}, * as soon as the region's execution vertices are finished. */ public class RegionPartitionReleaseStrategy implements PartitionReleaseStrategy { Review comment: That was a dumb mistake. Should be fixed now. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r412892530 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategy.java ## @@ -84,34 +77,8 @@ public RestartPipelinedRegionFailoverStrategy( ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker) { this.topology = checkNotNull(topology); - this.regions = Collections.newSetFromMap(new IdentityHashMap<>()); - this.vertexToRegionMap = new HashMap<>(); this.resultPartitionAvailabilityChecker = new RegionFailoverResultPartitionAvailabilityChecker( resultPartitionAvailabilityChecker); - - // build regions based on the given topology - LOG.info("Start building failover regions."); - buildFailoverRegions(); - } - // - // region building - // - - private void buildFailoverRegions() { - final Set> distinctRegions = - PipelinedRegionComputeUtil.computePipelinedRegions(topology); - - // creating all the failover regions and register them - for (Set regionVertices : distinctRegions) { - LOG.debug("Creating a failover region with {} vertices.", regionVertices.size()); - final FailoverRegion failoverRegion = new FailoverRegion(regionVertices); - regions.add(failoverRegion); - for (SchedulingExecutionVertex vertex : regionVertices) { - vertexToRegionMap.put(vertex.getId(), failoverRegion); - } - } - - LOG.info("Created {} failover regions.", regions.size()); Review comment: Makes sense. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r412884199 ## File path: flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adapter/DefaultSchedulingPipelinedRegionTest.java ## @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.flink.runtime.scheduler.adapter; + +import org.apache.flink.api.common.InputDependencyConstraint; +import org.apache.flink.runtime.execution.ExecutionState; +import org.apache.flink.runtime.executiongraph.ExecutionGraph; +import org.apache.flink.runtime.executiongraph.ExecutionGraphTestUtils; +import org.apache.flink.runtime.io.network.partition.ResultPartitionType; +import org.apache.flink.runtime.jobgraph.DistributionPattern; +import org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID; +import org.apache.flink.runtime.jobgraph.JobVertex; +import org.apache.flink.runtime.jobgraph.JobVertexID; +import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID; +import org.apache.flink.util.IterableUtils; +import org.apache.flink.util.TestLogger; + +import org.apache.flink.shaded.guava18.com.google.common.collect.Iterables; + +import org.junit.Test; + +import java.util.Collections; +import java.util.Iterator; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.sameInstance; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +/** + * Unit tests for {@link DefaultSchedulingPipelinedRegion}. + */ +public class DefaultSchedulingPipelinedRegionTest extends TestLogger { + + @Test + public void gettingUnknownVertexThrowsException() { + final DefaultSchedulingPipelinedRegion pipelinedRegion = new DefaultSchedulingPipelinedRegion(Collections.emptySet()); + final ExecutionVertexID unknownVertexId = new ExecutionVertexID(new JobVertexID(), 0); + try { + pipelinedRegion.getVertex(unknownVertexId); + fail("Expected exception not thrown"); + } catch (IllegalArgumentException e) { + assertThat(e.getMessage(), containsString(unknownVertexId + " not found")); + } + } + + @Test + public void returnsVertices() { + final DefaultExecutionVertex vertex = new DefaultExecutionVertex( + new ExecutionVertexID(new JobVertexID(), 0), + Collections.emptyList(), + () -> ExecutionState.CREATED, + InputDependencyConstraint.ANY); + + final Set vertices = Collections.singleton(vertex); + final DefaultSchedulingPipelinedRegion pipelinedRegion = new DefaultSchedulingPipelinedRegion(vertices); + final Iterator vertexIterator = pipelinedRegion.getVertices().iterator(); + + assertThat(vertexIterator.hasNext(), is(true)); + assertThat(vertexIterator.next(), is(sameInstance(vertex))); + assertThat(vertexIterator.hasNext(), is(false)); + } + + /** +* Tests if the consumed inputs of the pipelined regions are computed +* correctly using the Job graph below. +* +* c +*/ X +* a -+- b e +* \ / +*d +* +* Pipelined regions: {a}, {b, c, d, e} +*/ + @Test + public void returnsIncidentBlockingPartitions() throws Exception { + final JobVertex a = ExecutionGraphTestUtils.createNoOpVertex(1); + final JobVertex b = ExecutionGraphTestUtils.createNoOpVertex(1); + final JobVertex c = ExecutionGraphTestUtils.createNoOpVertex(1); + final JobVertex d = ExecutionGraphTestUtils.createNoOpVertex(1); + final JobVertex e = ExecutionGraphTestUtils.createNoOpVertex(1); + + b.connectNewDataSetAsInput(a, DistributionPattern.POINTWISE, ResultPartiti
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r412745971 ## File path: flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategyBuildingTest.java ## @@ -55,9 +56,9 @@ public void testIndividualVertices() { RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology); - FailoverRegion r1 = strategy.getFailoverRegion(v1.getId()); - FailoverRegion r2 = strategy.getFailoverRegion(v2.getId()); - FailoverRegion r3 = strategy.getFailoverRegion(v3.getId()); + SchedulingPipelinedRegion r1 = strategy.getFailoverRegion(v1.getId()); Review comment: As a follow-up issue, tests in this file should be migrated to something like `PipelinedRegionComputeUtilTest` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [flink] GJL commented on a change in pull request #11857: [FLINK-17180][runtime] Implement SchedulingPipelinedRegion interface
GJL commented on a change in pull request #11857: URL: https://github.com/apache/flink/pull/11857#discussion_r412745971 ## File path: flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/failover/flip1/RestartPipelinedRegionFailoverStrategyBuildingTest.java ## @@ -55,9 +56,9 @@ public void testIndividualVertices() { RestartPipelinedRegionFailoverStrategy strategy = new RestartPipelinedRegionFailoverStrategy(topology); - FailoverRegion r1 = strategy.getFailoverRegion(v1.getId()); - FailoverRegion r2 = strategy.getFailoverRegion(v2.getId()); - FailoverRegion r3 = strategy.getFailoverRegion(v3.getId()); + SchedulingPipelinedRegion r1 = strategy.getFailoverRegion(v1.getId()); Review comment: Tests in this file should be migrated to something like `PipelinedRegionComputeUtilTest` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org