@SuppressWarnings("unchecked") public void sendTezEventToSourceTasks(TezEvent tezEvent) { if (!bufferEvents.get()) { switch (tezEvent.getEventType()) { case INPUT_READ_ERROR_EVENT: InputReadErrorEvent event = (InputReadErrorEvent) tezEvent.getEvent(); TezTaskAttemptID destAttemptId = tezEvent.getSourceInfo().getTaskAttemptID(); int destTaskIndex = destAttemptId.getTaskID().getId(); int srcTaskIndex = edgeManager.routeEventToSourceTasks(destTaskIndex, event); int numConsumers = edgeManager.getDestinationConsumerTaskNumber( srcTaskIndex, destinationVertex.getTotalTasks()); TezTaskID srcTaskId = sourceVertex.getTask(srcTaskIndex).getTaskId(); int taskAttemptIndex = event.getVersion(); TezTaskAttemptID srcTaskAttemptId = new TezTaskAttemptID(srcTaskId, taskAttemptIndex); eventHandler.handle( new TaskAttemptEventOutputFailed(srcTaskAttemptId, tezEvent, numConsumers)); break; default: throw new TezUncheckedException("Unhandled tez event type: " + tezEvent.getEventType()); } } else { sourceEventBuffer.add(tezEvent); } }
@Override public int routeInputErrorEventToSource(InputReadErrorEvent event, int destinationTaskIndex) { int partitionRange = 1; if (destinationTaskIndex < numDestinationTasks - 1) { partitionRange = basePartitionRange; } else { partitionRange = remainderRangeForLastShuffler; } return event.getIndex() / partitionRange; }