问题
I am trying to programatically determine which task attempts run on which tasktracker in my cluster when submitting map reduce jobs to hadoop. I have found that I can get most of the task data from the JobClient like so:
jobClient.getMapTaskReports(jobID)
but not the hostname of the machine that a task attempt succeeded on. Does anybody know how to get the hostname from the task attempt id?
回答1:
The JobClient gives you a so called NetworkedJob when submitting. It has a method called getTaskCompletionEvents
.
That returns you an array of TaskCompletionEvent
that happened, those contain the HTTP address of the tasktracker that ran a task.
From that point you can parse the host from the URL.
来源:https://stackoverflow.com/questions/14712038/hadoop-find-hostname-of-task-attempt