flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From StephanEwen <...@git.apache.org>
Subject [GitHub] flink pull request #4916: [FLINK-7153] Re-introduce preferred locations for ...
Date Thu, 02 Nov 2017 13:06:33 GMT
Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4916#discussion_r148526103
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java
---
    @@ -1065,6 +1177,46 @@ private void sendUpdatePartitionInfoRpcCall(
     	//  Miscellaneous
     	// --------------------------------------------------------------------------------------------
     
    +	/**
    +	 * Calculates the preferred locations based on the location preference constraint.
    +	 *
    +	 * @param locationPreferenceConstraint constraint for the location preference
    +	 * @return Future containing the collection of preferred locations. This might not be
completed if not all inputs
    +	 * 		have been a resource assigned.
    +	 */
    +	@VisibleForTesting
    +	public CompletableFuture<Collection<TaskManagerLocation>> calculatePreferredLocations(LocationPreferenceConstraint
locationPreferenceConstraint) {
    +		final Collection<CompletableFuture<TaskManagerLocation>> preferredLocationFutures
= getVertex().getPreferredLocationsBasedOnInputs();
    +		final CompletableFuture<Collection<TaskManagerLocation>> preferredLocationsFuture;
    +
    +		switch(locationPreferenceConstraint) {
    +			case ALL:
    +				preferredLocationsFuture = FutureUtils.combineAll(preferredLocationFutures);
    +				break;
    +			case ANY:
    +				final ArrayList<TaskManagerLocation> completedTaskManagerLocations = new ArrayList<>(1);
    --- End diff --
    
    I would almost leave it at `1` or at the default `10`, so as to not have large unused
arrays lying around.


---

Mime
View raw message