[
https://issues.apache.org/jira/browse/MAPREDUCE-6298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550025#comment-14550025
]
Tsuyoshi Ozawa commented on MAPREDUCE-6298:
-------------------------------------------
[~lars_francke], thank you for your contribution. The design of the fix looks
good. Could you address following comments?
1. Why do we need to change following parts? It's fine to use sb.append here.
Also, we can use lineSep instead of append("\n"), but I think we should do this
on another JIRA.
{code}
- StringBuffer sb = new StringBuffer();
- sb.append("Job: ").append(status.getJobID()).append("\n");
- sb.append("Job File: ").append(status.getJobFile()).append("\n");
- sb.append("Job Tracking URL : ").append(status.getTrackingUrl());
- sb.append("\n");
- sb.append("Uber job : ").append(status.isUber()).append("\n");
- sb.append("Number of maps: ").append(numMaps).append("\n");
- sb.append("Number of reduces: ").append(numReduces).append("\n");
- sb.append("map() completion: ");
- sb.append(status.getMapProgress()).append("\n");
- sb.append("reduce() completion: ");
- sb.append(status.getReduceProgress()).append("\n");
- sb.append("Job state: ");
- sb.append(status.getState()).append("\n");
- sb.append("retired: ").append(status.isRetired()).append("\n");
- sb.append("reason for failure: ").append(reasonforFailure);
- return sb.toString();
{code}
2. About TestJob#testJobToString, could you add a test to preserve the result
of Job#toString() when the state of job is RUNNING?
> Job#toString throws an exception when not in state RUNNING
> ----------------------------------------------------------
>
> Key: MAPREDUCE-6298
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-6298
> Project: Hadoop Map/Reduce
> Issue Type: Bug
> Reporter: Lars Francke
> Assignee: Lars Francke
> Priority: Minor
> Labels: BB2015-05-TBR
> Attachments: MAPREDUCE-6298.1.patch, MAPREDUCE-6298.2.patch,
> MAPREDUCE-6298.3.patch
>
>
> Job#toString calls {{ensureState(JobState.RUNNING);}} as the very first
> thing. That method causes an Exception to be thrown which is not nice.
> One thing this breaks is usage of Job on the Scala (e.g. Spark) REPL as that
> calls toString after every invocation and that fails every time.
> I'll attach a patch that checks state and if it's RUNNING prints the original
> message and if not prints something else.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)