[
https://issues.apache.org/jira/browse/MAPREDUCE-6627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Kanter updated MAPREDUCE-6627:
-------------------------------------
Attachment: MAPREDUCE-6627.001.patch
I moved most of the printing code from {{HistoryViewer}} into a new class, so I
could create an interface to be able to implement other output formats. A lot
of the patch is moving that existing code. Otherwise, the patch adds the new
{{JobHistoryViewerJSONPrinter}} class, which prints mostly the same information
as the {{JobHistoryViewerHumanPrinter}}. It omits the Analysis section, as
that's not really necessary for this use case, and changes a few other things
to be more machine-friendly (e.g. using counter names instead of counter
display names and other misc formatting). I didn't change any of the
formatting of the existing human readable output for backwards compatibility.
I also added the ability to specify an output file for the results, which works
for either format and cleaned up the CLI parsing for this subcommand.
The command now looks like this:
{noformat}
mapred job -history [all] <jobHistoryFile> [-outfile <file>] [-format
<human|json>]]
{noformat}
It defaults to the human format and stdout.
> Add machine-readable output to mapred job -history command
> ----------------------------------------------------------
>
> Key: MAPREDUCE-6627
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-6627
> Project: Hadoop Map/Reduce
> Issue Type: Improvement
> Components: client
> Affects Versions: 2.9.0
> Reporter: Robert Kanter
> Assignee: Robert Kanter
> Attachments: MAPREDUCE-6627.001.patch, json.txt, json_all.txt
>
>
> It would be great if we could add a machine-readable output format, say JSON,
> to the {{mapred job -history \[all\] <jobHistoryFile>}} command so that it's
> easier for programs to consume that information and do further processing on
> it. At the same time, we should keep the existing API and formatting intact
> for backwards compatibility.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)