processTaskFailedEvent((InputFailedEvent) event);
}
}
private void processDataMovementEvent(DataMovementEvent dmEvent) throws IOException {
DataMovementEventPayloadProto shufflePayload;
try {
shufflePayload = DataMovementEventPayloadProto.parseFrom(ByteString.copyFrom(dmEvent.getUserPayload()));
} catch (InvalidProtocolBufferException e) {
throw new TezUncheckedException("Unable to parse DataMovementEvent payload", e);
}
int partitionId = dmEvent.getSourceIndex();
LOG.info("DataMovementEvent partitionId:" + partitionId + ", targetIndex: " + dmEvent.getTargetIndex()
+ ", attemptNum: " + dmEvent.getVersion() + ", payload: " + ShuffleUtils.stringify(shufflePayload));
// TODO NEWTEZ See if this duration hack can be removed.
int duration = shufflePayload.getRunDuration();
if (duration > maxMapRuntime) {
maxMapRuntime = duration;
scheduler.informMaxMapRunTime(maxMapRuntime);
}
if (shufflePayload.hasEmptyPartitions()) {
try {
byte[] emptyPartitions = TezCommonUtils.decompressByteStringToByteArray(shufflePayload.getEmptyPartitions());
BitSet emptyPartitionsBitSet = TezUtilsInternal.fromByteArray(emptyPartitions);
if (emptyPartitionsBitSet.get(partitionId)) {
InputAttemptIdentifier srcAttemptIdentifier =
new InputAttemptIdentifier(dmEvent.getTargetIndex(), dmEvent.getVersion());
LOG.info("Source partition: " + partitionId + " did not generate any data. SrcAttempt: ["
+ srcAttemptIdentifier + "]. Not fetching.");
scheduler.copySucceeded(srcAttemptIdentifier, null, 0, 0, 0, null);
return;
}
} catch (IOException e) {
throw new TezUncheckedException("Unable to set " +
"the empty partition to succeeded", e);
}
}
InputAttemptIdentifier srcAttemptIdentifier =
new InputAttemptIdentifier(dmEvent.getTargetIndex(), dmEvent.getVersion(),
shufflePayload.getPathComponent());
URI baseUri = getBaseURI(shufflePayload.getHost(), shufflePayload.getPort(), partitionId);
scheduler.addKnownMapOutput(shufflePayload.getHost(), shufflePayload.getPort(),
partitionId, baseUri.toString(), srcAttemptIdentifier);
}