YARN-4844. Addendum patch, revert few changes to public and evolving APIs to avoid breaking downstream projects as much as possible.

(cherry picked from commit 7eb524ddee)
This commit is contained in:
Wangda Tan 2016-06-16 11:09:56 -07:00
parent 394dae17ac
commit 93b406b66d
4 changed files with 26 additions and 18 deletions

View File

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

View File

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

View File

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

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.api.records; package org.apache.hadoop.yarn.api.records;
import org.apache.commons.lang.NotImplementedException;
import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.classification.InterfaceStability.Unstable;
@ -79,7 +80,9 @@ public abstract class Resource implements Comparable<Resource> {
*/ */
@Private @Private
@Unstable @Unstable
public abstract long getMemorySize(); public long getMemorySize() {
throw new NotImplementedException("getVirtualCoresSize is not implemented");
}
/** /**
* Set <em>memory</em> of the resource. * Set <em>memory</em> of the resource.
@ -106,7 +109,9 @@ public abstract class Resource implements Comparable<Resource> {
@Public @Public
@Unstable @Unstable
public abstract long getVirtualCoresSize(); public long getVirtualCoresSize() {
throw new NotImplementedException("getVirtualCoresSize is not implemented");
}
/** /**
* Set <em>number of virtual cpu cores</em> of the resource. * Set <em>number of virtual cpu cores</em> of the resource.
@ -120,7 +125,9 @@ public abstract class Resource implements Comparable<Resource> {
*/ */
@Public @Public
@Evolving @Evolving
public abstract void setVirtualCores(long vCores); public void setVirtualCores(long vCores) {
throw new NotImplementedException("getVirtualCoresSize is not implemented");
}
@Override @Override
public int hashCode() { public int hashCode() {