private void failTask(TaskAttemptID taskId, String reason,
boolean isFailed) {
TaskInProgress tip = taskLookupTable.getTIP(taskId);
Integer grantId = taskLookupTable.getGrantIdForTask(taskId);
ResourceGrant grant = resourceTracker.getGrant(grantId);
synchronized (lockObject) {
if (!tip.isAttemptRunning(taskId)) {
/*
* This attempt is not running so we should not be killing/failing it
* The reason we might try to fail the task that is not running is if it
* has finished and was preempted at the same time.
*/
return;
}
}
assert grant != null : "Task " + taskId +
" is running but has no associated resource";
String trackerName = grant.getNodeName();
TaskTrackerStatus trackerStatus =
getTaskTrackerStatus(trackerName);
TaskStatus.Phase phase =
tip.isMapTask() ? TaskStatus.Phase.MAP : TaskStatus.Phase.STARTING;