YARN-4844 (Addendum). Change JobStatus(usedMem,reservedMem,neededMem)

back to int for compatibility. Contributed by Wangda Tan
This commit is contained in:
Jian He 2016-12-20 11:28:19 -08:00
parent 3bcfe3a9de
commit 523411d69b
3 changed files with 16 additions and 15 deletions

View File

@ -521,13 +521,14 @@ public static JobStatus fromYarn(ApplicationReport application,
application.getApplicationResourceUsageReport();
if (resourceUsageReport != null) {
jobStatus.setNeededMem(
resourceUsageReport.getNeededResources().getMemorySize());
(int)resourceUsageReport.getNeededResources().getMemorySize());
jobStatus.setNumReservedSlots(
resourceUsageReport.getNumReservedContainers());
jobStatus.setNumUsedSlots(resourceUsageReport.getNumUsedContainers());
jobStatus.setReservedMem(
resourceUsageReport.getReservedResources().getMemorySize());
jobStatus.setUsedMem(resourceUsageReport.getUsedResources().getMemorySize());
(int)resourceUsageReport.getReservedResources().getMemorySize());
jobStatus.setUsedMem(
(int) resourceUsageReport.getUsedResources().getMemorySize());
}
return jobStatus;
}

View File

@ -95,9 +95,9 @@ public int getValue() {
private String trackingUrl ="";
private int numUsedSlots;
private int numReservedSlots;
private long usedMem;
private long reservedMem;
private long neededMem;
private int usedMem;
private int reservedMem;
private int neededMem;
private boolean isUber;
/**
@ -580,42 +580,42 @@ public void setNumReservedSlots(int n) {
/**
* @return the used memory
*/
public long getUsedMem() {
public int getUsedMem() {
return usedMem;
}
/**
* @param m the used memory
*/
public void setUsedMem(long m) {
public void setUsedMem(int m) {
this.usedMem = m;
}
/**
* @return the reserved memory
*/
public long getReservedMem() {
public int getReservedMem() {
return reservedMem;
}
/**
* @param r the reserved memory
*/
public void setReservedMem(long r) {
public void setReservedMem(int r) {
this.reservedMem = r;
}
/**
* @return the needed memory
*/
public long getNeededMem() {
public int getNeededMem() {
return neededMem;
}
/**
* @param n the needed memory
*/
public void setNeededMem(long n) {
public void setNeededMem(int n) {
this.neededMem = n;
}

View File

@ -170,9 +170,9 @@ public void testShowJob() throws Exception {
when(mockJobStatus.getPriority()).thenReturn(JobPriority.NORMAL);
when(mockJobStatus.getNumUsedSlots()).thenReturn(1);
when(mockJobStatus.getNumReservedSlots()).thenReturn(1);
when(mockJobStatus.getUsedMem()).thenReturn(1024L);
when(mockJobStatus.getReservedMem()).thenReturn(512L);
when(mockJobStatus.getNeededMem()).thenReturn(2048L);
when(mockJobStatus.getUsedMem()).thenReturn(1024);
when(mockJobStatus.getReservedMem()).thenReturn(512);
when(mockJobStatus.getNeededMem()).thenReturn(2048);
when(mockJobStatus.getSchedulingInfo()).thenReturn("NA");
Job mockJob = mock(Job.class);