MAPREDUCE-7343. Increase the job name max length in mapred job -list. (#2995). Contributed by Ayush Saxena.

This commit is contained in:
Ayush Saxena 2021-05-14 00:15:33 +05:30 committed by GitHub
parent 2e58fb671b
commit 5404ab4bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -771,10 +771,10 @@ public void displayJobList(JobStatus[] jobs)
} }
@Private @Private
public static String headerPattern = "%23s\t%20s\t%10s\t%14s\t%12s\t%12s" + public static String headerPattern = "%23s\t%40s\t%10s\t%14s\t%12s\t%12s" +
"\t%10s\t%15s\t%15s\t%8s\t%8s\t%10s\t%10s\n"; "\t%10s\t%15s\t%15s\t%8s\t%8s\t%10s\t%10s\n";
@Private @Private
public static String dataPattern = "%23s\t%20s\t%10s\t%14d\t%12s\t%12s" + public static String dataPattern = "%23s\t%40s\t%10s\t%14d\t%12s\t%12s" +
"\t%10s\t%15s\t%15s\t%8s\t%8s\t%10s\t%10s\n"; "\t%10s\t%15s\t%15s\t%8s\t%8s\t%10s\t%10s\n";
private static String memPattern = "%dM"; private static String memPattern = "%dM";
private static String UNAVAILABLE = "N/A"; private static String UNAVAILABLE = "N/A";
@ -792,8 +792,8 @@ public void displayJobList(JobStatus[] jobs, PrintWriter writer) {
long rsvdMem = job.getReservedMem(); long rsvdMem = job.getReservedMem();
long neededMem = job.getNeededMem(); long neededMem = job.getNeededMem();
int jobNameLength = job.getJobName().length(); int jobNameLength = job.getJobName().length();
writer.printf(dataPattern, job.getJobID().toString(), writer.printf(dataPattern, job.getJobID().toString(), job.getJobName()
job.getJobName().substring(0, jobNameLength > 20 ? 20 : jobNameLength), .substring(0, jobNameLength > 40 ? 40 : jobNameLength),
job.getState(), job.getStartTime(), job.getUsername(), job.getState(), job.getStartTime(), job.getUsername(),
job.getQueue(), job.getPriority().name(), job.getQueue(), job.getPriority().name(),
numUsedSlots < 0 ? UNAVAILABLE : numUsedSlots, numUsedSlots < 0 ? UNAVAILABLE : numUsedSlots,