eventsToSend.drainTo(events);
taskAttemptID = currentTaskAttemptID;
eventCounter = currentTask.getEventCounter();
eventsRange = maxEventsToGet;
if (!currentTask.isTaskDone() && !currentTask.hadFatalError()) {
updateEvent = new TezEvent(new TaskStatusUpdateEvent(
currentTask.getCounters(), currentTask.getProgress()),
new EventMetaData(EventProducerConsumerType.SYSTEM,
currentTask.getVertexName(), "", taskAttemptID));
events.add(updateEvent);
} else if (outOfBandEvents == null && events.isEmpty()) {