コード例 #1
0
 @Override
 public EventRouteMetadata routeInputSourceTaskFailedEventToDestination(
     int sourceTaskIndex, int destinationTaskIndex) throws Exception {
   int partitionRange = basePartitionRange;
   if (destinationTaskIndex == (numDestinationTasks - 1)) {
     partitionRange = remainderRangeForLastShuffler;
   }
   int startOffset = sourceTaskIndex * partitionRange;
   int[] targetIndices = new int[partitionRange];
   for (int i = 0; i < partitionRange; ++i) {
     targetIndices[i] = (startOffset + i);
   }
   return EventRouteMetadata.create(partitionRange, targetIndices);
 }
コード例 #2
0
    @Override
    public EventRouteMetadata routeDataMovementEventToDestination(
        int sourceTaskIndex, int sourceOutputIndex, int destTaskIndex) throws Exception {
      int sourceIndex = sourceOutputIndex;
      int destinationTaskIndex = sourceIndex / basePartitionRange;
      if (destinationTaskIndex != destTaskIndex) {
        return null;
      }
      int partitionRange = 1;
      if (destinationTaskIndex < numDestinationTasks - 1) {
        partitionRange = basePartitionRange;
      } else {
        partitionRange = remainderRangeForLastShuffler;
      }

      // all inputs from a source task are next to each other in original order
      int targetIndex = sourceTaskIndex * partitionRange + sourceIndex % partitionRange;
      return EventRouteMetadata.create(1, new int[] {targetIndex});
    }
コード例 #3
0
    @Override
    public @Nullable EventRouteMetadata routeCompositeDataMovementEventToDestination(
        int sourceTaskIndex, int destinationTaskIndex) throws Exception {
      int[] targetIndicesToSend;
      int partitionRange;
      if (destinationTaskIndex == (numDestinationTasks - 1)) {
        if (remainderRangeForLastShuffler != basePartitionRange) {
          targetIndicesToSend = createTargetIndicesForRemainder(sourceTaskIndex);
        } else {
          targetIndicesToSend = targetIndices[sourceTaskIndex];
        }
        partitionRange = remainderRangeForLastShuffler;
      } else {
        targetIndicesToSend = targetIndices[sourceTaskIndex];
        partitionRange = basePartitionRange;
      }

      return EventRouteMetadata.create(
          partitionRange, targetIndicesToSend, sourceIndices[destinationTaskIndex]);
    }