[
https://issues.apache.org/jira/browse/MAPREDUCE-5392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13709504#comment-13709504
]
Tsuyoshi OZAWA commented on MAPREDUCE-5392:
-------------------------------------------
{code}
+ Configuration config = new Configuration();
+ String hsHostPath = config.get("mapreduce.jobhistory.webapp.address",
"localhost") +
+ "/jobhistory/logs";
{code}
This config.get() always returns "localhost", because the instance of
Configuration class is created with no user-defined configurations. In fully
distributed mode, it may not works well.
{code}
+ String hostport = attempt.getHostname() + ":" +
Integer.toString(attempt.getPort());
+ String containerId = attempt.getContainerId().toString();
+ Configuration config = new Configuration();
+ String hsHostPath = config.get("mapreduce.jobhistory.webapp.address",
"localhost") +
+ "/jobhistory/logs";
+ return HttpConfig.getSchemePrefix() + hsHostPath + "/" + hostport + "/" +
containerId +
+ "/" + attempt.getAttemptId().toString() + "/" + username;
{code}
IMHO, we should move these code into HostUtil.java and create a method like
getTaskLogUrl() with arguments you need. And we should also add tests as
follows against HostUtil.java to confirm not having the backwards:
1. a node name is given by "tracker_"
2. a node name is NOT given by "tracker_"
TestJobHistoryParsing.java seems to be good place to add tests. What do you
think?
> Fix "mapred job -history all" command
> -------------------------------------
>
> Key: MAPREDUCE-5392
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-5392
> Project: Hadoop Map/Reduce
> Issue Type: Bug
> Components: mrv2
> Affects Versions: 3.0.0
> Reporter: Shinichi Yamashita
> Assignee: Shinichi Yamashita
> Priority: Minor
> Attachments: MAPREDUCE-5392.patch
>
>
> When I use an "all" option by "mapred job -history" comamnd, the following
> exceptions are displayed and do not work.
> {code}
> Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String
> index out of range: -3
> at java.lang.String.substring(String.java:1875)
> at
> org.apache.hadoop.mapreduce.util.HostUtil.convertTrackerNameToHostName(HostUtil.java:49)
> at
> org.apache.hadoop.mapreduce.jobhistory.HistoryViewer.getTaskLogsUrl(HistoryViewer.java:459)
> at
> org.apache.hadoop.mapreduce.jobhistory.HistoryViewer.printAllTaskAttempts(HistoryViewer.java:235)
> at
> org.apache.hadoop.mapreduce.jobhistory.HistoryViewer.print(HistoryViewer.java:117)
> at org.apache.hadoop.mapreduce.tools.CLI.viewHistory(CLI.java:472)
> at org.apache.hadoop.mapreduce.tools.CLI.run(CLI.java:313)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
> at org.apache.hadoop.mapred.JobClient.main(JobClient.java:1233)
> {code}
> This is because a node name recorded in History file is not given "tracker_".
> Therefore it makes modifications to be able to read History file even if a
> node name is not given by "tracker_".
> In addition, it fixes the URL of displayed task log.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira