You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/01/08 16:34:25 UTC

[GitHub] tillrohrmann commented on a change in pull request #7255: [FLINK-10945] Use InputDependencyConstraint to avoid resource dead…

tillrohrmann commented on a change in pull request #7255: [FLINK-10945] Use InputDependencyConstraint to avoid resource dead…
URL: https://github.com/apache/flink/pull/7255#discussion_r246052711
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java
 ##########
 @@ -726,6 +730,41 @@ void sendPartitionInfos() {
 		}
 	}
 
+	/**
+	 * Check whether the InputDependencyConstraint is satisfied for this vertex.
+	 *
+	 * @return whether the input constraint is satisfied
+	 */
+	public boolean checkInputDependencyConstraints() {
+		if (getExecutionGraph().getInputDependencyConstraint() == InputDependencyConstraint.ANY) {
+			// InputDependencyConstraint == ANY
+			return IntStream.range(0, inputEdges.length).anyMatch(this::isInputConsumable);
+		} else {
+			// InputDependencyConstraint == ALL
+			return IntStream.range(0, inputEdges.length).allMatch(this::isInputConsumable);
+		}
+	}
+
+	/**
+	 * An input is consumable when
+	 * 1. the source result is PIPELINED and one of the result partition has produced data.
+	 * 2. the source result is BLOCKING and is FINISHED(all partitions are FINISHED).
+	 *
+	 * @return whether the input is consumable
+	 */
+	public boolean isInputConsumable(int inputNumber) {
 
 Review comment:
   I think this method should be moved into the `IntermediateResult`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services