YARN-6971. Clean up different ways to create resources. Contributed by Riya Khandelwal
This commit is contained in:
parent
29f2230cb6
commit
815cde9810
@ -148,6 +148,7 @@
|
|||||||
import org.apache.hadoop.yarn.util.Clock;
|
import org.apache.hadoop.yarn.util.Clock;
|
||||||
import org.apache.hadoop.yarn.util.ControlledClock;
|
import org.apache.hadoop.yarn.util.ControlledClock;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.apache.hadoop.yarn.util.SystemClock;
|
import org.apache.hadoop.yarn.util.SystemClock;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
@ -502,8 +503,8 @@ public void testPreemptReducers() throws Exception {
|
|||||||
0, 0, 0, 0, 0, 0, "jobfile", null, false, ""));
|
0, 0, 0, 0, 0, 0, "jobfile", null, false, ""));
|
||||||
MyContainerAllocator allocator = new MyContainerAllocator(rm, conf,
|
MyContainerAllocator allocator = new MyContainerAllocator(rm, conf,
|
||||||
appAttemptId, mockJob, SystemClock.getInstance());
|
appAttemptId, mockJob, SystemClock.getInstance());
|
||||||
allocator.setMapResourceRequest(BuilderUtils.newResource(1024, 1));
|
allocator.setMapResourceRequest(Resources.createResource(1024));
|
||||||
allocator.setReduceResourceRequest(BuilderUtils.newResource(1024, 1));
|
allocator.setReduceResourceRequest(Resources.createResource(1024));
|
||||||
RMContainerAllocator.AssignedRequests assignedRequests =
|
RMContainerAllocator.AssignedRequests assignedRequests =
|
||||||
allocator.getAssignedRequests();
|
allocator.getAssignedRequests();
|
||||||
RMContainerAllocator.ScheduledRequests scheduledRequests =
|
RMContainerAllocator.ScheduledRequests scheduledRequests =
|
||||||
@ -557,8 +558,8 @@ public void testNonAggressivelyPreemptReducers() throws Exception {
|
|||||||
clock.setTime(1);
|
clock.setTime(1);
|
||||||
MyContainerAllocator allocator = new MyContainerAllocator(rm, conf,
|
MyContainerAllocator allocator = new MyContainerAllocator(rm, conf,
|
||||||
appAttemptId, mockJob, clock);
|
appAttemptId, mockJob, clock);
|
||||||
allocator.setMapResourceRequest(BuilderUtils.newResource(1024, 1));
|
allocator.setMapResourceRequest(Resources.createResource(1024));
|
||||||
allocator.setReduceResourceRequest(BuilderUtils.newResource(1024, 1));
|
allocator.setReduceResourceRequest(Resources.createResource(1024));
|
||||||
RMContainerAllocator.AssignedRequests assignedRequests =
|
RMContainerAllocator.AssignedRequests assignedRequests =
|
||||||
allocator.getAssignedRequests();
|
allocator.getAssignedRequests();
|
||||||
RMContainerAllocator.ScheduledRequests scheduledRequests =
|
RMContainerAllocator.ScheduledRequests scheduledRequests =
|
||||||
@ -622,8 +623,8 @@ public void testUnconditionalPreemptReducers() throws Exception {
|
|||||||
clock.setTime(1);
|
clock.setTime(1);
|
||||||
MyContainerAllocator allocator = new MyContainerAllocator(rm, conf,
|
MyContainerAllocator allocator = new MyContainerAllocator(rm, conf,
|
||||||
appAttemptId, mockJob, clock);
|
appAttemptId, mockJob, clock);
|
||||||
allocator.setMapResourceRequest(BuilderUtils.newResource(1024, 1));
|
allocator.setMapResourceRequest(Resources.createResource(1024));
|
||||||
allocator.setReduceResourceRequest(BuilderUtils.newResource(1024, 1));
|
allocator.setReduceResourceRequest(Resources.createResource(1024));
|
||||||
RMContainerAllocator.AssignedRequests assignedRequests =
|
RMContainerAllocator.AssignedRequests assignedRequests =
|
||||||
allocator.getAssignedRequests();
|
allocator.getAssignedRequests();
|
||||||
RMContainerAllocator.ScheduledRequests scheduledRequests =
|
RMContainerAllocator.ScheduledRequests scheduledRequests =
|
||||||
@ -2205,8 +2206,8 @@ public void testReduceScheduling() throws Exception {
|
|||||||
int scheduledReduces = 0;
|
int scheduledReduces = 0;
|
||||||
int assignedMaps = 2;
|
int assignedMaps = 2;
|
||||||
int assignedReduces = 0;
|
int assignedReduces = 0;
|
||||||
Resource mapResourceReqt = BuilderUtils.newResource(1024, 1);
|
Resource mapResourceReqt = Resources.createResource(1024);
|
||||||
Resource reduceResourceReqt = BuilderUtils.newResource(2 * 1024, 1);
|
Resource reduceResourceReqt = Resources.createResource(2 * 1024);
|
||||||
int numPendingReduces = 4;
|
int numPendingReduces = 4;
|
||||||
float maxReduceRampupLimit = 0.5f;
|
float maxReduceRampupLimit = 0.5f;
|
||||||
float reduceSlowStart = 0.2f;
|
float reduceSlowStart = 0.2f;
|
||||||
@ -2241,7 +2242,7 @@ public void testReduceScheduling() throws Exception {
|
|||||||
verify(allocator, never()).scheduleAllReduces();
|
verify(allocator, never()).scheduleAllReduces();
|
||||||
|
|
||||||
succeededMaps = 3;
|
succeededMaps = 3;
|
||||||
doReturn(BuilderUtils.newResource(0, 0)).when(allocator).getResourceLimit();
|
doReturn(Resources.createResource(0)).when(allocator).getResourceLimit();
|
||||||
allocator.scheduleReduces(
|
allocator.scheduleReduces(
|
||||||
totalMaps, succeededMaps,
|
totalMaps, succeededMaps,
|
||||||
scheduledMaps, scheduledReduces,
|
scheduledMaps, scheduledReduces,
|
||||||
@ -2252,7 +2253,7 @@ public void testReduceScheduling() throws Exception {
|
|||||||
verify(allocator, times(1)).setIsReduceStarted(true);
|
verify(allocator, times(1)).setIsReduceStarted(true);
|
||||||
|
|
||||||
// Test reduce ramp-up
|
// Test reduce ramp-up
|
||||||
doReturn(BuilderUtils.newResource(100 * 1024, 100 * 1)).when(allocator)
|
doReturn(Resources.createResource(100 * 1024, 100 * 1)).when(allocator)
|
||||||
.getResourceLimit();
|
.getResourceLimit();
|
||||||
allocator.scheduleReduces(
|
allocator.scheduleReduces(
|
||||||
totalMaps, succeededMaps,
|
totalMaps, succeededMaps,
|
||||||
@ -2266,7 +2267,7 @@ public void testReduceScheduling() throws Exception {
|
|||||||
|
|
||||||
// Test reduce ramp-down
|
// Test reduce ramp-down
|
||||||
scheduledReduces = 3;
|
scheduledReduces = 3;
|
||||||
doReturn(BuilderUtils.newResource(10 * 1024, 10 * 1)).when(allocator)
|
doReturn(Resources.createResource(10 * 1024, 10 * 1)).when(allocator)
|
||||||
.getResourceLimit();
|
.getResourceLimit();
|
||||||
allocator.scheduleReduces(
|
allocator.scheduleReduces(
|
||||||
totalMaps, succeededMaps,
|
totalMaps, succeededMaps,
|
||||||
@ -2282,7 +2283,7 @@ public void testReduceScheduling() throws Exception {
|
|||||||
// should be invoked twice.
|
// should be invoked twice.
|
||||||
scheduledMaps = 2;
|
scheduledMaps = 2;
|
||||||
assignedReduces = 2;
|
assignedReduces = 2;
|
||||||
doReturn(BuilderUtils.newResource(10 * 1024, 10 * 1)).when(allocator)
|
doReturn(Resources.createResource(10 * 1024, 10 * 1)).when(allocator)
|
||||||
.getResourceLimit();
|
.getResourceLimit();
|
||||||
allocator.scheduleReduces(
|
allocator.scheduleReduces(
|
||||||
totalMaps, succeededMaps,
|
totalMaps, succeededMaps,
|
||||||
@ -2300,7 +2301,7 @@ public void testReduceScheduling() throws Exception {
|
|||||||
// Test ramp-down when enough memory but not enough cpu resource
|
// Test ramp-down when enough memory but not enough cpu resource
|
||||||
scheduledMaps = 10;
|
scheduledMaps = 10;
|
||||||
assignedReduces = 0;
|
assignedReduces = 0;
|
||||||
doReturn(BuilderUtils.newResource(100 * 1024, 5 * 1)).when(allocator)
|
doReturn(Resources.createResource(100 * 1024, 5 * 1)).when(allocator)
|
||||||
.getResourceLimit();
|
.getResourceLimit();
|
||||||
allocator.scheduleReduces(totalMaps, succeededMaps, scheduledMaps,
|
allocator.scheduleReduces(totalMaps, succeededMaps, scheduledMaps,
|
||||||
scheduledReduces, assignedMaps, assignedReduces, mapResourceReqt,
|
scheduledReduces, assignedMaps, assignedReduces, mapResourceReqt,
|
||||||
@ -2309,7 +2310,7 @@ public void testReduceScheduling() throws Exception {
|
|||||||
verify(allocator, times(3)).rampDownReduces(anyInt());
|
verify(allocator, times(3)).rampDownReduces(anyInt());
|
||||||
|
|
||||||
// Test ramp-down when enough cpu but not enough memory resource
|
// Test ramp-down when enough cpu but not enough memory resource
|
||||||
doReturn(BuilderUtils.newResource(10 * 1024, 100 * 1)).when(allocator)
|
doReturn(Resources.createResource(10 * 1024, 100 * 1)).when(allocator)
|
||||||
.getResourceLimit();
|
.getResourceLimit();
|
||||||
allocator.scheduleReduces(totalMaps, succeededMaps, scheduledMaps,
|
allocator.scheduleReduces(totalMaps, succeededMaps, scheduledMaps,
|
||||||
scheduledReduces, assignedMaps, assignedReduces, mapResourceReqt,
|
scheduledReduces, assignedMaps, assignedReduces, mapResourceReqt,
|
||||||
|
@ -62,9 +62,9 @@
|
|||||||
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
||||||
import org.apache.hadoop.yarn.server.AMHeartbeatRequestHandler;
|
import org.apache.hadoop.yarn.server.AMHeartbeatRequestHandler;
|
||||||
import org.apache.hadoop.yarn.server.AMRMClientRelayer;
|
import org.apache.hadoop.yarn.server.AMRMClientRelayer;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.AsyncCallback;
|
import org.apache.hadoop.yarn.util.AsyncCallback;
|
||||||
import org.apache.hadoop.yarn.util.ConverterUtils;
|
import org.apache.hadoop.yarn.util.ConverterUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ private void submitUnmanagedApp(ApplicationId appId)
|
|||||||
|
|
||||||
ContainerLaunchContext amContainer =
|
ContainerLaunchContext amContainer =
|
||||||
this.recordFactory.newRecordInstance(ContainerLaunchContext.class);
|
this.recordFactory.newRecordInstance(ContainerLaunchContext.class);
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
context.setResource(resource);
|
context.setResource(resource);
|
||||||
context.setAMContainerSpec(amContainer);
|
context.setAMContainerSpec(amContainer);
|
||||||
submitRequest.setApplicationSubmissionContext(context);
|
submitRequest.setApplicationSubmissionContext(context);
|
||||||
|
@ -118,6 +118,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -243,7 +244,7 @@ public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
|
|||||||
ContainerId.newContainerId(appAttemptID, heartBeatID.get());
|
ContainerId.newContainerId(appAttemptID, heartBeatID.get());
|
||||||
ContainerLaunchContext launchContext = recordFactory
|
ContainerLaunchContext launchContext = recordFactory
|
||||||
.newRecordInstance(ContainerLaunchContext.class);
|
.newRecordInstance(ContainerLaunchContext.class);
|
||||||
Resource resource = BuilderUtils.newResource(2, 1);
|
Resource resource = Resources.createResource(2, 1);
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
String user = "testUser";
|
String user = "testUser";
|
||||||
ContainerTokenIdentifier containerToken = BuilderUtils
|
ContainerTokenIdentifier containerToken = BuilderUtils
|
||||||
@ -286,7 +287,7 @@ public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
|
|||||||
.newRecordInstance(ContainerLaunchContext.class);
|
.newRecordInstance(ContainerLaunchContext.class);
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
String user = "testUser";
|
String user = "testUser";
|
||||||
Resource resource = BuilderUtils.newResource(3, 1);
|
Resource resource = Resources.createResource(3, 1);
|
||||||
ContainerTokenIdentifier containerToken = BuilderUtils
|
ContainerTokenIdentifier containerToken = BuilderUtils
|
||||||
.newContainerTokenIdentifier(BuilderUtils.newContainerToken(
|
.newContainerTokenIdentifier(BuilderUtils.newContainerToken(
|
||||||
secondContainerID, 0, InetAddress.getByName("localhost")
|
secondContainerID, 0, InetAddress.getByName("localhost")
|
||||||
@ -990,7 +991,7 @@ public void testRemovePreviousCompletedContainersFromContext() throws Exception
|
|||||||
ContainerId cId = ContainerId.newContainerId(appAttemptId, 1);
|
ContainerId cId = ContainerId.newContainerId(appAttemptId, 1);
|
||||||
Token containerToken =
|
Token containerToken =
|
||||||
BuilderUtils.newContainerToken(cId, 0, "anyHost", 1234, "anyUser",
|
BuilderUtils.newContainerToken(cId, 0, "anyHost", 1234, "anyUser",
|
||||||
BuilderUtils.newResource(1024, 1), 0, 123,
|
Resources.createResource(1024), 0, 123,
|
||||||
"password".getBytes(), 0);
|
"password".getBytes(), 0);
|
||||||
Container anyCompletedContainer = new ContainerImpl(conf, null,
|
Container anyCompletedContainer = new ContainerImpl(conf, null,
|
||||||
null, null, null,
|
null, null, null,
|
||||||
@ -1012,7 +1013,7 @@ public org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Cont
|
|||||||
ContainerId.newContainerId(appAttemptId, 3);
|
ContainerId.newContainerId(appAttemptId, 3);
|
||||||
Token runningContainerToken =
|
Token runningContainerToken =
|
||||||
BuilderUtils.newContainerToken(runningContainerId, 0, "anyHost",
|
BuilderUtils.newContainerToken(runningContainerId, 0, "anyHost",
|
||||||
1234, "anyUser", BuilderUtils.newResource(1024, 1), 0, 123,
|
1234, "anyUser", Resources.createResource(1024), 0, 123,
|
||||||
"password".getBytes(), 0);
|
"password".getBytes(), 0);
|
||||||
Container runningContainer =
|
Container runningContainer =
|
||||||
new ContainerImpl(conf, null, null, null, null,
|
new ContainerImpl(conf, null, null, null, null,
|
||||||
@ -1071,7 +1072,7 @@ public void testCompletedContainersIsRecentlyStopped() throws Exception {
|
|||||||
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
|
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
|
||||||
Token containerToken =
|
Token containerToken =
|
||||||
BuilderUtils.newContainerToken(containerId, 0, "host", 1234, "user",
|
BuilderUtils.newContainerToken(containerId, 0, "host", 1234, "user",
|
||||||
BuilderUtils.newResource(1024, 1), 0, 123,
|
Resources.createResource(1024), 0, 123,
|
||||||
"password".getBytes(), 0);
|
"password".getBytes(), 0);
|
||||||
|
|
||||||
Container completedContainer = new ContainerImpl(conf, null,
|
Container completedContainer = new ContainerImpl(conf, null,
|
||||||
@ -1110,7 +1111,7 @@ public void testCleanedupApplicationContainerCleanup() throws IOException {
|
|||||||
ContainerId cId = ContainerId.newContainerId(appAttemptId, 1);
|
ContainerId cId = ContainerId.newContainerId(appAttemptId, 1);
|
||||||
Token containerToken =
|
Token containerToken =
|
||||||
BuilderUtils.newContainerToken(cId, 0, "anyHost", 1234, "anyUser",
|
BuilderUtils.newContainerToken(cId, 0, "anyHost", 1234, "anyUser",
|
||||||
BuilderUtils.newResource(1024, 1), 0, 123,
|
Resources.createResource(1024), 0, 123,
|
||||||
"password".getBytes(), 0);
|
"password".getBytes(), 0);
|
||||||
Container anyCompletedContainer = new ContainerImpl(conf, null,
|
Container anyCompletedContainer = new ContainerImpl(conf, null,
|
||||||
null, null, null,
|
null, null, null,
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
|
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
|
||||||
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -439,7 +440,7 @@ public static Token createContainerToken(ContainerId cId, long rmIdentifier,
|
|||||||
NMContainerTokenSecretManager containerTokenSecretManager,
|
NMContainerTokenSecretManager containerTokenSecretManager,
|
||||||
LogAggregationContext logAggregationContext)
|
LogAggregationContext logAggregationContext)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Resource r = BuilderUtils.newResource(1024, 1);
|
Resource r = Resources.createResource(1024);
|
||||||
return createContainerToken(cId, rmIdentifier, nodeId, user, r,
|
return createContainerToken(cId, rmIdentifier, nodeId, user, r,
|
||||||
containerTokenSecretManager, logAggregationContext);
|
containerTokenSecretManager, logAggregationContext);
|
||||||
}
|
}
|
||||||
@ -449,7 +450,7 @@ public static Token createContainerToken(ContainerId cId, long rmIdentifier,
|
|||||||
NMContainerTokenSecretManager containerTokenSecretManager,
|
NMContainerTokenSecretManager containerTokenSecretManager,
|
||||||
LogAggregationContext logAggregationContext, ContainerType containerType)
|
LogAggregationContext logAggregationContext, ContainerType containerType)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Resource r = BuilderUtils.newResource(1024, 1);
|
Resource r = Resources.createResource(1024);
|
||||||
return createContainerToken(cId, rmIdentifier, nodeId, user, r,
|
return createContainerToken(cId, rmIdentifier, nodeId, user, r,
|
||||||
containerTokenSecretManager, logAggregationContext, containerType);
|
containerTokenSecretManager, logAggregationContext, containerType);
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService;
|
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
import org.apache.hadoop.yarn.util.ControlledClock;
|
import org.apache.hadoop.yarn.util.ControlledClock;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentMatcher;
|
import org.mockito.ArgumentMatcher;
|
||||||
@ -1391,7 +1392,7 @@ protected void scheduleContainer(Container container) {
|
|||||||
cId = BuilderUtils.newContainerId(appId, 1, timestamp, id);
|
cId = BuilderUtils.newContainerId(appId, 1, timestamp, id);
|
||||||
when(mockContainer.getId()).thenReturn(cId);
|
when(mockContainer.getId()).thenReturn(cId);
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
when(mockContainer.getResource()).thenReturn(resource);
|
when(mockContainer.getResource()).thenReturn(resource);
|
||||||
String host = "127.0.0.1";
|
String host = "127.0.0.1";
|
||||||
int port = 1234;
|
int port = 1234;
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
import org.apache.hadoop.yarn.util.AuxiliaryServiceHelper;
|
import org.apache.hadoop.yarn.util.AuxiliaryServiceHelper;
|
||||||
import org.apache.hadoop.yarn.util.LinuxResourceCalculatorPlugin;
|
import org.apache.hadoop.yarn.util.LinuxResourceCalculatorPlugin;
|
||||||
import org.apache.hadoop.yarn.util.ResourceCalculatorPlugin;
|
import org.apache.hadoop.yarn.util.ResourceCalculatorPlugin;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Assume;
|
import org.junit.Assume;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -1481,7 +1482,7 @@ public void handle(Event event) {
|
|||||||
|
|
||||||
protected Token createContainerToken(ContainerId cId, Priority priority,
|
protected Token createContainerToken(ContainerId cId, Priority priority,
|
||||||
long createTime) throws InvalidToken {
|
long createTime) throws InvalidToken {
|
||||||
Resource r = BuilderUtils.newResource(1024, 1);
|
Resource r = Resources.createResource(1024);
|
||||||
ContainerTokenIdentifier containerTokenIdentifier =
|
ContainerTokenIdentifier containerTokenIdentifier =
|
||||||
new ContainerTokenIdentifier(cId, context.getNodeId().toString(), user,
|
new ContainerTokenIdentifier(cId, context.getNodeId().toString(), user,
|
||||||
r, System.currentTimeMillis() + 10000L, 123, DUMMY_RM_IDENTIFIER,
|
r, System.currentTimeMillis() + 10000L, 123, DUMMY_RM_IDENTIFIER,
|
||||||
|
@ -143,6 +143,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
import org.apache.hadoop.yarn.util.ConverterUtils;
|
import org.apache.hadoop.yarn.util.ConverterUtils;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
@ -2293,7 +2294,7 @@ private ContainerId createContainer(ApplicationAttemptId appAttemptId1,
|
|||||||
long cId, ContainerType containerType) {
|
long cId, ContainerType containerType) {
|
||||||
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId1,
|
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId1,
|
||||||
cId);
|
cId);
|
||||||
Resource r = BuilderUtils.newResource(1024, 1);
|
Resource r = Resources.createResource(1024);
|
||||||
ContainerTokenIdentifier containerToken = new ContainerTokenIdentifier(
|
ContainerTokenIdentifier containerToken = new ContainerTokenIdentifier(
|
||||||
containerId, context.getNodeId().toString(), user, r,
|
containerId, context.getNodeId().toString(), user, r,
|
||||||
System.currentTimeMillis() + 100000L, 123, DUMMY_RM_IDENTIFIER,
|
System.currentTimeMillis() + 100000L, 123, DUMMY_RM_IDENTIFIER,
|
||||||
|
@ -86,6 +86,7 @@
|
|||||||
import org.apache.hadoop.yarn.util.ProcfsBasedProcessTree;
|
import org.apache.hadoop.yarn.util.ProcfsBasedProcessTree;
|
||||||
import org.apache.hadoop.yarn.util.ResourceCalculatorPlugin;
|
import org.apache.hadoop.yarn.util.ResourceCalculatorPlugin;
|
||||||
import org.apache.hadoop.yarn.util.TestProcfsBasedProcessTree;
|
import org.apache.hadoop.yarn.util.TestProcfsBasedProcessTree;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -301,7 +302,7 @@ public void testContainerKillOnMemoryOverflow() throws IOException,
|
|||||||
commands.add("/bin/bash");
|
commands.add("/bin/bash");
|
||||||
commands.add(scriptFile.getAbsolutePath());
|
commands.add(scriptFile.getAbsolutePath());
|
||||||
containerLaunchContext.setCommands(commands);
|
containerLaunchContext.setCommands(commands);
|
||||||
Resource r = BuilderUtils.newResource(0, 0);
|
Resource r = Resources.createResource(0);
|
||||||
ContainerTokenIdentifier containerIdentifier =
|
ContainerTokenIdentifier containerIdentifier =
|
||||||
new ContainerTokenIdentifier(cId, context.getNodeId().toString(), user,
|
new ContainerTokenIdentifier(cId, context.getNodeId().toString(), user,
|
||||||
r, System.currentTimeMillis() + 120000, 123, DUMMY_RM_IDENTIFIER,
|
r, System.currentTimeMillis() + 120000, 123, DUMMY_RM_IDENTIFIER,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ExecutionType;
|
import org.apache.hadoop.yarn.api.records.ExecutionType;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.BaseContainerManagerTest;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.BaseContainerManagerTest;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -70,7 +70,7 @@ public void testForceStartGuaranteedContainersWhenOppContainerDisabled()
|
|||||||
// on the RM side it won't check vcores at all.
|
// on the RM side it won't check vcores at all.
|
||||||
list.add(StartContainerRequest.newInstance(containerLaunchContext,
|
list.add(StartContainerRequest.newInstance(containerLaunchContext,
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(), user, BuilderUtils.newResource(2048, 4),
|
context.getNodeId(), user, Resources.createResource(2048, 4),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.BaseContainerManagerTest;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.BaseContainerManagerTest;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.BaseContainerSchedulerTest;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.BaseContainerSchedulerTest;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerState;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerState;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ public void testKillOpportunisticWhenNoResourcesAvailable() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ public void testKillOpportunisticWhenNoResourcesAvailable() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ public void testOpportunisticRunsWhenResourcesAvailable() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerEventType;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerEventType;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerState;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerState;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerChain;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerChain;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -86,14 +86,14 @@ public void testStartMultipleContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(1024, 1),
|
user, Resources.createResource(1024),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(1024, 1),
|
user, Resources.createResource(1024),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -141,14 +141,14 @@ public void testQueueMultipleContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(3072, 1),
|
user, Resources.createResource(3072),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(3072, 1),
|
user, Resources.createResource(3072),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -198,21 +198,21 @@ public void testStartAndQueueMultipleContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(1024, 1),
|
user, Resources.createResource(1024),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(1024, 1),
|
user, Resources.createResource(1024),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ public void testStartOpportunisticsWhenOppQueueIsFull() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ public void testStartOpportunisticsWhenOppQueueIsFull() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
}
|
}
|
||||||
@ -354,21 +354,21 @@ public void testKillOpportunisticForGuaranteedContainer() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ public void testPauseOpportunisticForGuaranteedContainer() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ public void testPauseOpportunisticForGuaranteedContainer() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
allRequests =
|
allRequests =
|
||||||
@ -560,7 +560,7 @@ public void testQueueShedding() throws Exception {
|
|||||||
containerLaunchContext,
|
containerLaunchContext,
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
@ -573,42 +573,42 @@ public void testQueueShedding() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(3), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(3), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(4), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(4), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(5), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(5), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(6), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(6), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ public void testContainerDeQueuedAfterAMKill() throws Exception {
|
|||||||
containerLaunchContext,
|
containerLaunchContext,
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
@ -694,14 +694,14 @@ public void testContainerDeQueuedAfterAMKill() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -743,21 +743,21 @@ public void testKillMultipleOpportunisticContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ public void testKillMultipleOpportunisticContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(3), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(3), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(1500, 1),
|
user, Resources.createResource(1500),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
|
|
||||||
@ -824,7 +824,7 @@ public void testKillOnlyRequiredOpportunisticContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
}
|
}
|
||||||
@ -840,7 +840,7 @@ public void testKillOnlyRequiredOpportunisticContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(i), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
}
|
}
|
||||||
@ -888,21 +888,21 @@ public void testStopQueuedContainer() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED)));
|
ExecutionType.GUARANTEED)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(2), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -994,14 +994,14 @@ public void testPromotionOfOpportunisticContainers() throws Exception {
|
|||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(0), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(2048, 1),
|
user, Resources.createResource(2048),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
list.add(StartContainerRequest.newInstance(
|
list.add(StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(),
|
context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(1024, 1),
|
user, Resources.createResource(1024),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC)));
|
ExecutionType.OPPORTUNISTIC)));
|
||||||
|
|
||||||
@ -1044,7 +1044,7 @@ public void testPromotionOfOpportunisticContainers() throws Exception {
|
|||||||
// Promote Queued Opportunistic Container
|
// Promote Queued Opportunistic Container
|
||||||
Token updateToken =
|
Token updateToken =
|
||||||
createContainerToken(createContainerId(1), 1, DUMMY_RM_IDENTIFIER,
|
createContainerToken(createContainerId(1), 1, DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(), user, BuilderUtils.newResource(1024, 1),
|
context.getNodeId(), user, Resources.createResource(1024),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.GUARANTEED);
|
ExecutionType.GUARANTEED);
|
||||||
List<Token> updateTokens = new ArrayList<Token>();
|
List<Token> updateTokens = new ArrayList<Token>();
|
||||||
@ -1115,7 +1115,7 @@ public void testContainerUpdateExecTypeGuaranteedToOpportunistic()
|
|||||||
StartContainerRequest.newInstance(
|
StartContainerRequest.newInstance(
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
recordFactory.newRecordInstance(ContainerLaunchContext.class),
|
||||||
createContainerToken(cId, DUMMY_RM_IDENTIFIER,
|
createContainerToken(cId, DUMMY_RM_IDENTIFIER,
|
||||||
context.getNodeId(), user, BuilderUtils.newResource(512, 1),
|
context.getNodeId(), user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null));
|
context.getContainerTokenSecretManager(), null));
|
||||||
List<StartContainerRequest> list = new ArrayList<>();
|
List<StartContainerRequest> list = new ArrayList<>();
|
||||||
list.add(scRequest);
|
list.add(scRequest);
|
||||||
@ -1130,7 +1130,7 @@ public void testContainerUpdateExecTypeGuaranteedToOpportunistic()
|
|||||||
List<Token> updateTokens = new ArrayList<>();
|
List<Token> updateTokens = new ArrayList<>();
|
||||||
Token containerToken =
|
Token containerToken =
|
||||||
createContainerToken(cId, 1, DUMMY_RM_IDENTIFIER, context.getNodeId(),
|
createContainerToken(cId, 1, DUMMY_RM_IDENTIFIER, context.getNodeId(),
|
||||||
user, BuilderUtils.newResource(512, 1),
|
user, Resources.createResource(512),
|
||||||
context.getContainerTokenSecretManager(), null,
|
context.getContainerTokenSecretManager(), null,
|
||||||
ExecutionType.OPPORTUNISTIC);
|
ExecutionType.OPPORTUNISTIC);
|
||||||
updateTokens.add(containerToken);
|
updateTokens.add(containerToken);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMMemoryStateStoreService;
|
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMMemoryStateStoreService;
|
||||||
import org.apache.hadoop.yarn.server.security.BaseContainerTokenSecretManager;
|
import org.apache.hadoop.yarn.server.security.BaseContainerTokenSecretManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestNMContainerTokenSecretManager {
|
public class TestNMContainerTokenSecretManager {
|
||||||
@ -122,7 +123,7 @@ private static ContainerTokenIdentifier createContainerTokenId(
|
|||||||
long rmid = cid.getApplicationAttemptId().getApplicationId()
|
long rmid = cid.getApplicationAttemptId().getApplicationId()
|
||||||
.getClusterTimestamp();
|
.getClusterTimestamp();
|
||||||
ContainerTokenIdentifier ctid = new ContainerTokenIdentifier(cid,
|
ContainerTokenIdentifier ctid = new ContainerTokenIdentifier(cid,
|
||||||
nodeId.toString(), user, BuilderUtils.newResource(1024, 1),
|
nodeId.toString(), user, Resources.createResource(1024),
|
||||||
System.currentTimeMillis() + 100000L,
|
System.currentTimeMillis() + 100000L,
|
||||||
secretMgr.getCurrentKey().getKeyId(), rmid,
|
secretMgr.getCurrentKey().getKeyId(), rmid,
|
||||||
Priority.newInstance(0), 0);
|
Priority.newInstance(0), 0);
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceSet;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceSet;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerExecutionException;
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerExecutionException;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -73,7 +74,7 @@ public MockContainer(ApplicationAttemptId appAttemptId,
|
|||||||
this.containerTokenIdentifier =
|
this.containerTokenIdentifier =
|
||||||
BuilderUtils.newContainerTokenIdentifier(BuilderUtils
|
BuilderUtils.newContainerTokenIdentifier(BuilderUtils
|
||||||
.newContainerToken(id, 0, "127.0.0.1", 1234, user,
|
.newContainerToken(id, 0, "127.0.0.1", 1234, user,
|
||||||
BuilderUtils.newResource(1024, 1), currentTime + 10000, 123,
|
Resources.createResource(1024), currentTime + 10000, 123,
|
||||||
"password".getBytes(), currentTime));
|
"password".getBytes(), currentTime));
|
||||||
this.state = ContainerState.NEW;
|
this.state = ContainerState.NEW;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
|
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
|
||||||
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -211,7 +211,7 @@ public boolean isPmemCheckEnabled() {
|
|||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
Token containerToken =
|
Token containerToken =
|
||||||
BuilderUtils.newContainerToken(containerId, 0, "127.0.0.1", 1234,
|
BuilderUtils.newContainerToken(containerId, 0, "127.0.0.1", 1234,
|
||||||
user, BuilderUtils.newResource(1024, 1), currentTime + 10000L,
|
user, Resources.createResource(1024), currentTime + 10000L,
|
||||||
123, "password".getBytes(), currentTime);
|
123, "password".getBytes(), currentTime);
|
||||||
Context context = mock(Context.class);
|
Context context = mock(Context.class);
|
||||||
Container container =
|
Container container =
|
||||||
|
@ -199,6 +199,7 @@
|
|||||||
|
|
||||||
import org.apache.hadoop.classification.VisibleForTesting;
|
import org.apache.hadoop.classification.VisibleForTesting;
|
||||||
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
|
import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
|
||||||
|
|
||||||
|
|
||||||
@ -1086,7 +1087,7 @@ public GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request)
|
|||||||
private NodeReport createNodeReports(RMNode rmNode) {
|
private NodeReport createNodeReports(RMNode rmNode) {
|
||||||
SchedulerNodeReport schedulerNodeReport =
|
SchedulerNodeReport schedulerNodeReport =
|
||||||
scheduler.getNodeReport(rmNode.getNodeID());
|
scheduler.getNodeReport(rmNode.getNodeID());
|
||||||
Resource used = BuilderUtils.newResource(0, 0);
|
Resource used = Resources.createResource(0);
|
||||||
int numContainers = 0;
|
int numContainers = 0;
|
||||||
if (schedulerNodeReport != null) {
|
if (schedulerNodeReport != null) {
|
||||||
used = schedulerNodeReport.getUsedResource();
|
used = schedulerNodeReport.getUsedResource();
|
||||||
|
@ -407,7 +407,7 @@ private void handleNodeUpdates(RMApp app, AllocateResponse allocateResponse) {
|
|||||||
RMNode rmNode = rmNodeEntry.getKey();
|
RMNode rmNode = rmNodeEntry.getKey();
|
||||||
SchedulerNodeReport schedulerNodeReport =
|
SchedulerNodeReport schedulerNodeReport =
|
||||||
getScheduler().getNodeReport(rmNode.getNodeID());
|
getScheduler().getNodeReport(rmNode.getNodeID());
|
||||||
Resource used = BuilderUtils.newResource(0, 0);
|
Resource used = Resources.createResource(0);
|
||||||
int numContainers = 0;
|
int numContainers = 0;
|
||||||
if (schedulerNodeReport != null) {
|
if (schedulerNodeReport != null) {
|
||||||
used = schedulerNodeReport.getUsedResource();
|
used = schedulerNodeReport.getUsedResource();
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ResourceInformation;
|
import org.apache.hadoop.yarn.api.records.ResourceInformation;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.exceptions.ResourceNotFoundException;
|
import org.apache.hadoop.yarn.exceptions.ResourceNotFoundException;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.UnitsConversionUtil;
|
import org.apache.hadoop.yarn.util.UnitsConversionUtil;
|
||||||
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
@ -629,7 +628,7 @@ private static ConfigurableResource parseOldStyleResource(String input)
|
|||||||
final int memory = parseOldStyleResourceMemory(resources);
|
final int memory = parseOldStyleResourceMemory(resources);
|
||||||
final int vcores = parseOldStyleResourceVcores(resources);
|
final int vcores = parseOldStyleResourceVcores(resources);
|
||||||
return new ConfigurableResource(
|
return new ConfigurableResource(
|
||||||
BuilderUtils.newResource(memory, vcores));
|
Resources.createResource(memory, vcores));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] findOldStyleResourcesInSpaceSeparatedInput(
|
private static String[] findOldStyleResourcesInSpaceSeparatedInput(
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ private ApplicationId submitAppAndGetAppId(String submitter,
|
|||||||
ApplicationId applicationId =
|
ApplicationId applicationId =
|
||||||
submitterClient.getNewApplication(newAppRequest).getApplicationId();
|
submitterClient.getNewApplication(newAppRequest).getApplicationId();
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
Map<ApplicationAccessType, String> acls = createACLs(submitter, setupACLs);
|
Map<ApplicationAccessType, String> acls = createACLs(submitter, setupACLs);
|
||||||
ContainerLaunchContext amContainerSpec =
|
ContainerLaunchContext amContainerSpec =
|
||||||
ContainerLaunchContext.newInstance(null, null, null, null, null, acls);
|
ContainerLaunchContext.newInstance(null, null, null, null, null, acls);
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
.allocationfile.AllocationFileQueue;
|
.allocationfile.AllocationFileQueue;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair
|
||||||
.allocationfile.AllocationFileWriter;
|
.allocationfile.AllocationFileWriter;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -69,7 +69,7 @@ public class ReservationACLsTestBase extends ACLsTestBase {
|
|||||||
|
|
||||||
private final int defaultDuration = 600000;
|
private final int defaultDuration = 600000;
|
||||||
private final ReservationRequest defaultRequest = ReservationRequest
|
private final ReservationRequest defaultRequest = ReservationRequest
|
||||||
.newInstance(BuilderUtils.newResource(1024, 1), 1, 1,
|
.newInstance(Resources.createResource(1024), 1, 1,
|
||||||
defaultDuration);
|
defaultDuration);
|
||||||
private final ReservationRequests defaultRequests = ReservationRequests
|
private final ReservationRequests defaultRequests = ReservationRequests
|
||||||
.newInstance(Collections.singletonList(defaultRequest),
|
.newInstance(Collections.singletonList(defaultRequest),
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
@ -246,7 +246,7 @@ private ApplicationId submitAppAndGetAppId(AccessControlList viewACL,
|
|||||||
|
|
||||||
ContainerLaunchContext amContainer = recordFactory
|
ContainerLaunchContext amContainer = recordFactory
|
||||||
.newRecordInstance(ContainerLaunchContext.class);
|
.newRecordInstance(ContainerLaunchContext.class);
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
context.setResource(resource);
|
context.setResource(resource);
|
||||||
amContainer.setApplicationACLs(acls);
|
amContainer.setApplicationACLs(acls);
|
||||||
if (conf.get(YarnConfiguration.RM_SCHEDULER)
|
if (conf.get(YarnConfiguration.RM_SCHEDULER)
|
||||||
@ -456,7 +456,7 @@ private void verifyInvalidQueueWithAcl() throws Exception {
|
|||||||
new HashMap<ApplicationAccessType, String>();
|
new HashMap<ApplicationAccessType, String>();
|
||||||
ContainerLaunchContext amContainer =
|
ContainerLaunchContext amContainer =
|
||||||
recordFactory.newRecordInstance(ContainerLaunchContext.class);
|
recordFactory.newRecordInstance(ContainerLaunchContext.class);
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
context.setResource(resource);
|
context.setResource(resource);
|
||||||
amContainer.setApplicationACLs(acls);
|
amContainer.setApplicationACLs(acls);
|
||||||
context.setQueue("InvalidQueue");
|
context.setQueue("InvalidQueue");
|
||||||
|
@ -2728,9 +2728,9 @@ protected ClientRMService createClientRMService() {
|
|||||||
resourceManager = rm;
|
resourceManager = rm;
|
||||||
rm.start();
|
rm.start();
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(976562);
|
||||||
resource.setResourceInformation("memory-mb",
|
resource.setResourceInformation("memory-mb",
|
||||||
ResourceInformation.newInstance("memory-mb", "G", 1024));
|
ResourceInformation.newInstance("memory-mb", "G", 976562));
|
||||||
resource.setResourceInformation("resource1",
|
resource.setResourceInformation("resource1",
|
||||||
ResourceInformation.newInstance("resource1", "T", 1));
|
ResourceInformation.newInstance("resource1", "T", 1));
|
||||||
resource.setResourceInformation("resource2",
|
resource.setResourceInformation("resource2",
|
||||||
@ -2771,8 +2771,8 @@ protected ClientRMService createClientRMService() {
|
|||||||
Assert.assertEquals(1000000000, nodeReports.get(0).getCapability().
|
Assert.assertEquals(1000000000, nodeReports.get(0).getCapability().
|
||||||
getResourceInformation("resource2").getValue());
|
getResourceInformation("resource2").getValue());
|
||||||
|
|
||||||
//Resource 'memory-mb' has been passed as 1024G while registering NM
|
//Resource 'memory-mb' has been passed as 976562G while registering NM
|
||||||
//1024G should be converted to 976562Mi
|
//976562G should be converted to 976562Mi
|
||||||
Assert.assertEquals("Mi", nodeReports.get(0).getCapability().
|
Assert.assertEquals("Mi", nodeReports.get(0).getCapability().
|
||||||
getResourceInformation("memory-mb").getUnits());
|
getResourceInformation("memory-mb").getUnits());
|
||||||
Assert.assertEquals(976562, nodeReports.get(0).getCapability().
|
Assert.assertEquals(976562, nodeReports.get(0).getCapability().
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
import org.apache.hadoop.yarn.util.ConverterUtils;
|
import org.apache.hadoop.yarn.util.ConverterUtils;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -570,9 +571,9 @@ protected void serviceStop() throws Exception {
|
|||||||
|
|
||||||
private static ResourceScheduler createMockScheduler(Configuration conf) {
|
private static ResourceScheduler createMockScheduler(Configuration conf) {
|
||||||
ResourceScheduler mockSched = mock(ResourceScheduler.class);
|
ResourceScheduler mockSched = mock(ResourceScheduler.class);
|
||||||
doReturn(BuilderUtils.newResource(512, 0)).when(mockSched)
|
doReturn(Resources.createResource(512)).when(mockSched)
|
||||||
.getMinimumResourceCapability();
|
.getMinimumResourceCapability();
|
||||||
doReturn(BuilderUtils.newResource(5120, 0)).when(mockSched)
|
doReturn(Resources.createResource(5120)).when(mockSched)
|
||||||
.getMaximumResourceCapability();
|
.getMaximumResourceCapability();
|
||||||
return mockSched;
|
return mockSched;
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.YarnServerBuilderUtils;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@ -613,7 +614,7 @@ public void testNodeRegistrationSuccess() throws Exception {
|
|||||||
RegisterNodeManagerRequest req = Records.newRecord(
|
RegisterNodeManagerRequest req = Records.newRecord(
|
||||||
RegisterNodeManagerRequest.class);
|
RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
req.setHttpPort(1234);
|
req.setHttpPort(1234);
|
||||||
@ -655,7 +656,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -704,7 +705,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -757,7 +758,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest req =
|
RegisterNodeManagerRequest req =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
req.setHttpPort(1234);
|
req.setHttpPort(1234);
|
||||||
@ -808,7 +809,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest req =
|
RegisterNodeManagerRequest req =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
req.setHttpPort(1234);
|
req.setHttpPort(1234);
|
||||||
@ -851,7 +852,7 @@ public void testNodeRegistrationWithAttributes() throws Exception {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
NodeAttribute nodeAttribute1 = NodeAttribute
|
NodeAttribute nodeAttribute1 = NodeAttribute
|
||||||
.newInstance(NodeAttribute.PREFIX_DISTRIBUTED, "Attr1",
|
.newInstance(NodeAttribute.PREFIX_DISTRIBUTED, "Attr1",
|
||||||
NodeAttributeType.STRING, "V1");
|
NodeAttributeType.STRING, "V1");
|
||||||
@ -898,7 +899,7 @@ public void testNodeRegistrationWithInvalidAttributes() throws Exception {
|
|||||||
RegisterNodeManagerRequest req =
|
RegisterNodeManagerRequest req =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
NodeAttribute validNodeAttribute = NodeAttribute
|
NodeAttribute validNodeAttribute = NodeAttribute
|
||||||
.newInstance(NodeAttribute.PREFIX_DISTRIBUTED, "Attr1",
|
.newInstance(NodeAttribute.PREFIX_DISTRIBUTED, "Attr1",
|
||||||
NodeAttributeType.STRING, "V1");
|
NodeAttributeType.STRING, "V1");
|
||||||
@ -1001,7 +1002,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -1073,7 +1074,7 @@ public void testNodeHeartbeatWithNodeAttributes() throws Exception {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -1150,7 +1151,7 @@ public void testNodeHeartbeatWithInvalidNodeAttributes() throws Exception {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -1284,7 +1285,7 @@ public Object answer(InvocationOnMock invocation) throws Exception {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -1441,7 +1442,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
@ -1494,7 +1495,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
RegisterNodeManagerRequest req =
|
RegisterNodeManagerRequest req =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
req.setHttpPort(1234);
|
req.setHttpPort(1234);
|
||||||
@ -1542,7 +1543,7 @@ public void testNodeRegistrationVersionLessThanRM() throws Exception {
|
|||||||
RegisterNodeManagerRequest req = Records.newRecord(
|
RegisterNodeManagerRequest req = Records.newRecord(
|
||||||
RegisterNodeManagerRequest.class);
|
RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
req.setHttpPort(1234);
|
req.setHttpPort(1234);
|
||||||
@ -1611,7 +1612,7 @@ public void testNodeRegistrationWithMinimumAllocations() throws Exception {
|
|||||||
NodeId nodeId = BuilderUtils.newNodeId("host", 1234);
|
NodeId nodeId = BuilderUtils.newNodeId("host", 1234);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
|
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
RegisterNodeManagerResponse response1 =
|
RegisterNodeManagerResponse response1 =
|
||||||
resourceTrackerService.registerNodeManager(req);
|
resourceTrackerService.registerNodeManager(req);
|
||||||
@ -2777,7 +2778,7 @@ protected Dispatcher createDispatcher() {
|
|||||||
RegisterNodeManagerRequest req = Records.newRecord(
|
RegisterNodeManagerRequest req = Records.newRecord(
|
||||||
RegisterNodeManagerRequest.class);
|
RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
NodeId nodeId = NodeId.newInstance("host2", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
|
|
||||||
NodeStatus mockNodeStatus = createMockNodeStatus();
|
NodeStatus mockNodeStatus = createMockNodeStatus();
|
||||||
|
|
||||||
@ -3058,7 +3059,7 @@ public void testSystemCredentialsAfterTokenSequenceNoChange()
|
|||||||
recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
|
recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
|
||||||
request.setNodeId(nodeId);
|
request.setNodeId(nodeId);
|
||||||
request.setHttpPort(1234);
|
request.setHttpPort(1234);
|
||||||
request.setResource(BuilderUtils.newResource(1024, 1));
|
request.setResource(Resources.createResource(1024));
|
||||||
resourceTrackerService.registerNodeManager(request);
|
resourceTrackerService.registerNodeManager(request);
|
||||||
|
|
||||||
org.apache.hadoop.yarn.server.api.records.NodeStatus nodeStatus =
|
org.apache.hadoop.yarn.server.api.records.NodeStatus nodeStatus =
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -133,7 +133,7 @@ private void registerNode(ResourceManager rm, NodeId nodeId)
|
|||||||
rm.getResourceTrackerService();
|
rm.getResourceTrackerService();
|
||||||
RegisterNodeManagerRequest req =
|
RegisterNodeManagerRequest req =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
req.setResource(capability);
|
req.setResource(capability);
|
||||||
req.setNodeId(nodeId);
|
req.setNodeId(nodeId);
|
||||||
req.setHttpPort(1234);
|
req.setHttpPort(1234);
|
||||||
|
@ -46,8 +46,8 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public void testNMExpiry() throws Exception {
|
|||||||
String hostname1 = "localhost1";
|
String hostname1 = "localhost1";
|
||||||
String hostname2 = "localhost2";
|
String hostname2 = "localhost2";
|
||||||
String hostname3 = "localhost3";
|
String hostname3 = "localhost3";
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
|
|
||||||
NodeStatus mockNodeStatus = createMockNodeStatus();
|
NodeStatus mockNodeStatus = createMockNodeStatus();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -133,7 +133,7 @@ public void tearDown() {
|
|||||||
@Test
|
@Test
|
||||||
public void testReconnect() throws Exception {
|
public void testReconnect() throws Exception {
|
||||||
String hostname1 = "localhost1";
|
String hostname1 = "localhost1";
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
|
|
||||||
RegisterNodeManagerRequest request1 = recordFactory
|
RegisterNodeManagerRequest request1 = recordFactory
|
||||||
.newRecordInstance(RegisterNodeManagerRequest.class);
|
.newRecordInstance(RegisterNodeManagerRequest.class);
|
||||||
@ -152,7 +152,7 @@ public void testReconnect() throws Exception {
|
|||||||
|
|
||||||
rmNodeEvents.clear();
|
rmNodeEvents.clear();
|
||||||
resourceTrackerService.registerNodeManager(request1);
|
resourceTrackerService.registerNodeManager(request1);
|
||||||
capability = BuilderUtils.newResource(1024, 2);
|
capability = Resources.createResource(1024, 2);
|
||||||
request1.setResource(capability);
|
request1.setResource(capability);
|
||||||
Assert.assertEquals(RMNodeEventType.RECONNECTED,
|
Assert.assertEquals(RMNodeEventType.RECONNECTED,
|
||||||
rmNodeEvents.get(0).getType());
|
rmNodeEvents.get(0).getType());
|
||||||
@ -176,7 +176,7 @@ public void testCompareRMNodeAfterReconnect() throws Exception {
|
|||||||
dispatcher.register(SchedulerEventType.class, scheduler);
|
dispatcher.register(SchedulerEventType.class, scheduler);
|
||||||
|
|
||||||
String hostname1 = "localhost1";
|
String hostname1 = "localhost1";
|
||||||
Resource capability = BuilderUtils.newResource(4096, 4);
|
Resource capability = Resources.createResource(4096, 4);
|
||||||
|
|
||||||
RegisterNodeManagerRequest request1 = recordFactory
|
RegisterNodeManagerRequest request1 = recordFactory
|
||||||
.newRecordInstance(RegisterNodeManagerRequest.class);
|
.newRecordInstance(RegisterNodeManagerRequest.class);
|
||||||
@ -195,7 +195,7 @@ public void testCompareRMNodeAfterReconnect() throws Exception {
|
|||||||
context.getRMNodes().get(nodeId1));
|
context.getRMNodes().get(nodeId1));
|
||||||
Assert.assertEquals(context.getRMNodes().get(nodeId1).
|
Assert.assertEquals(context.getRMNodes().get(nodeId1).
|
||||||
getTotalCapability(), capability);
|
getTotalCapability(), capability);
|
||||||
Resource capability1 = BuilderUtils.newResource(2048, 2);
|
Resource capability1 = Resources.createResource(2048, 2);
|
||||||
request1.setResource(capability1);
|
request1.setResource(capability1);
|
||||||
resourceTrackerService.registerNodeManager(request1);
|
resourceTrackerService.registerNodeManager(request1);
|
||||||
Assert.assertNotNull(context.getRMNodes().get(nodeId1));
|
Assert.assertNotNull(context.getRMNodes().get(nodeId1));
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -94,7 +94,7 @@ public void tearDown() {
|
|||||||
@Test
|
@Test
|
||||||
public void testRPCResponseId() throws IOException, YarnException {
|
public void testRPCResponseId() throws IOException, YarnException {
|
||||||
String node = "localhost";
|
String node = "localhost";
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
RegisterNodeManagerRequest request = recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
|
RegisterNodeManagerRequest request = recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
|
||||||
nodeId = NodeId.newInstance(node, 1234);
|
nodeId = NodeId.newInstance(node, 1234);
|
||||||
request.setNodeId(nodeId);
|
request.setNodeId(nodeId);
|
||||||
|
@ -311,7 +311,7 @@ public void setUp() throws Exception {
|
|||||||
final String queue = MockApps.newQueue();
|
final String queue = MockApps.newQueue();
|
||||||
submissionContext = mock(ApplicationSubmissionContext.class);
|
submissionContext = mock(ApplicationSubmissionContext.class);
|
||||||
when(submissionContext.getQueue()).thenReturn(queue);
|
when(submissionContext.getQueue()).thenReturn(queue);
|
||||||
Resource resource = BuilderUtils.newResource(1536, 1);
|
Resource resource = Resources.createResource(1536);
|
||||||
ContainerLaunchContext amContainerSpec =
|
ContainerLaunchContext amContainerSpec =
|
||||||
BuilderUtils.newContainerLaunchContext(null, null,
|
BuilderUtils.newContainerLaunchContext(null, null,
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
@ -629,7 +629,7 @@ private Container allocateApplicationAttempt() {
|
|||||||
|
|
||||||
// Mock the allocation of AM container
|
// Mock the allocation of AM container
|
||||||
Container container = mock(Container.class);
|
Container container = mock(Container.class);
|
||||||
Resource resource = BuilderUtils.newResource(2048, 1);
|
Resource resource = Resources.createResource(2048);
|
||||||
when(container.getId()).thenReturn(
|
when(container.getId()).thenReturn(
|
||||||
BuilderUtils.newContainerId(applicationAttempt.getAppAttemptId(), 1));
|
BuilderUtils.newContainerId(applicationAttempt.getAppAttemptId(), 1));
|
||||||
when(container.getResource()).thenReturn(resource);
|
when(container.getResource()).thenReturn(resource);
|
||||||
@ -1199,7 +1199,7 @@ public void testLaunchedFailWhileAHSEnabled() {
|
|||||||
RMAppAttemptEventType.ATTEMPT_ADDED));
|
RMAppAttemptEventType.ATTEMPT_ADDED));
|
||||||
|
|
||||||
Container amContainer = mock(Container.class);
|
Container amContainer = mock(Container.class);
|
||||||
Resource resource = BuilderUtils.newResource(2048, 1);
|
Resource resource = Resources.createResource(2048);
|
||||||
when(amContainer.getId()).thenReturn(
|
when(amContainer.getId()).thenReturn(
|
||||||
BuilderUtils.newContainerId(myApplicationAttempt.getAppAttemptId(), 1));
|
BuilderUtils.newContainerId(myApplicationAttempt.getAppAttemptId(), 1));
|
||||||
when(amContainer.getResource()).thenReturn(resource);
|
when(amContainer.getResource()).thenReturn(resource);
|
||||||
@ -1763,7 +1763,7 @@ public void testContainerRemovedBeforeAllocate() {
|
|||||||
|
|
||||||
// Mock the allocation of AM container
|
// Mock the allocation of AM container
|
||||||
Container container = mock(Container.class);
|
Container container = mock(Container.class);
|
||||||
Resource resource = BuilderUtils.newResource(2048, 1);
|
Resource resource = Resources.createResource(2048);
|
||||||
when(container.getId()).thenReturn(
|
when(container.getId()).thenReturn(
|
||||||
BuilderUtils.newContainerId(applicationAttempt.getAppAttemptId(), 1));
|
BuilderUtils.newContainerId(applicationAttempt.getAppAttemptId(), 1));
|
||||||
when(container.getResource()).thenReturn(resource);
|
when(container.getResource()).thenReturn(resource);
|
||||||
|
@ -73,6 +73,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.AllocationTagsManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.AllocationTagsManager;
|
||||||
import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey;
|
import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
@ -100,7 +101,7 @@ public void testReleaseWhileRunning() {
|
|||||||
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
||||||
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(512, 1);
|
Resource resource = Resources.createResource(512);
|
||||||
Priority priority = BuilderUtils.newPriority(5);
|
Priority priority = BuilderUtils.newPriority(5);
|
||||||
|
|
||||||
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
||||||
@ -206,7 +207,7 @@ public void testExpireWhileRunning() {
|
|||||||
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
||||||
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(512, 1);
|
Resource resource = Resources.createResource(512);
|
||||||
Priority priority = BuilderUtils.newPriority(5);
|
Priority priority = BuilderUtils.newPriority(5);
|
||||||
|
|
||||||
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
||||||
@ -407,7 +408,7 @@ public void testContainerTransitionNotifyAllocationTagsManager()
|
|||||||
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
||||||
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(512, 1);
|
Resource resource = Resources.createResource(512);
|
||||||
Priority priority = BuilderUtils.newPriority(5);
|
Priority priority = BuilderUtils.newPriority(5);
|
||||||
|
|
||||||
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
||||||
@ -582,7 +583,7 @@ public void testContainerAcquiredAtKilled() {
|
|||||||
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
|
||||||
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
ContainerAllocationExpirer expirer = mock(ContainerAllocationExpirer.class);
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(512, 1);
|
Resource resource = Resources.createResource(512);
|
||||||
Priority priority = BuilderUtils.newPriority(5);
|
Priority priority = BuilderUtils.newPriority(5);
|
||||||
|
|
||||||
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
Container container = BuilderUtils.newContainer(containerId, nodeId,
|
||||||
|
@ -84,7 +84,6 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager;
|
||||||
import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey;
|
import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@ -1048,7 +1047,7 @@ public void testNodemanagerReconnect() throws Exception {
|
|||||||
|
|
||||||
// Register node1
|
// Register node1
|
||||||
String hostname1 = "localhost1";
|
String hostname1 = "localhost1";
|
||||||
Resource capability = BuilderUtils.newResource(4096, 4);
|
Resource capability = Resources.createResource(4096, 4);
|
||||||
RecordFactory recordFactory =
|
RecordFactory recordFactory =
|
||||||
RecordFactoryProvider.getRecordFactory(null);
|
RecordFactoryProvider.getRecordFactory(null);
|
||||||
|
|
||||||
@ -1068,7 +1067,7 @@ public void testNodemanagerReconnect() throws Exception {
|
|||||||
Assert.assertEquals("Initial cluster resources don't match", capability,
|
Assert.assertEquals("Initial cluster resources don't match", capability,
|
||||||
clusterResource);
|
clusterResource);
|
||||||
|
|
||||||
Resource newCapability = BuilderUtils.newResource(1024, 1);
|
Resource newCapability = Resources.createResource(1024);
|
||||||
RegisterNodeManagerRequest request2 =
|
RegisterNodeManagerRequest request2 =
|
||||||
recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
|
recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
|
||||||
request2.setNodeId(nodeId1);
|
request2.setNodeId(nodeId1);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ACLsTestBase;
|
import org.apache.hadoop.yarn.server.resourcemanager.ACLsTestBase;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ private ApplicationSubmissionContext prepareForAppSubmission(String submitter,
|
|||||||
ApplicationId applicationId = submitterClient
|
ApplicationId applicationId = submitterClient
|
||||||
.getNewApplication(newAppRequest).getApplicationId();
|
.getNewApplication(newAppRequest).getApplicationId();
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
|
|
||||||
ContainerLaunchContext amContainerSpec = ContainerLaunchContext
|
ContainerLaunchContext amContainerSpec = ContainerLaunchContext
|
||||||
.newInstance(null, null, null, null, null, null);
|
.newInstance(null, null, null, null, null, null);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -52,7 +52,7 @@ private ApplicationId submitApplication(MockRM rm, String queue)
|
|||||||
final ApplicationAttemptId appAttemptId = TestUtils
|
final ApplicationAttemptId appAttemptId = TestUtils
|
||||||
.getMockApplicationAttemptId(appId++, 1);
|
.getMockApplicationAttemptId(appId++, 1);
|
||||||
|
|
||||||
Resource resource = BuilderUtils.newResource(1024, 1);
|
Resource resource = Resources.createResource(1024);
|
||||||
ContainerLaunchContext amContainerSpec = ContainerLaunchContext
|
ContainerLaunchContext amContainerSpec = ContainerLaunchContext
|
||||||
.newInstance(null, null, null, null, null, null);
|
.newInstance(null, null, null, null, null, null);
|
||||||
ApplicationSubmissionContext asc = ApplicationSubmissionContext
|
ApplicationSubmissionContext asc = ApplicationSubmissionContext
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAddedSchedulerEvent;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAddedSchedulerEvent;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptAddedSchedulerEvent;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptAddedSchedulerEvent;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@ -124,7 +123,7 @@ protected ResourceRequest createResourceRequest(
|
|||||||
int memory, int vcores, String host, int priority, int numContainers,
|
int memory, int vcores, String host, int priority, int numContainers,
|
||||||
boolean relaxLocality) {
|
boolean relaxLocality) {
|
||||||
ResourceRequest request = recordFactory.newRecordInstance(ResourceRequest.class);
|
ResourceRequest request = recordFactory.newRecordInstance(ResourceRequest.class);
|
||||||
request.setCapability(BuilderUtils.newResource(memory, vcores));
|
request.setCapability(Resources.createResource(memory, vcores));
|
||||||
request.setResourceName(host);
|
request.setResourceName(host);
|
||||||
request.setNumContainers(numContainers);
|
request.setNumContainers(numContainers);
|
||||||
Priority prio = recordFactory.newRecordInstance(Priority.class);
|
Priority prio = recordFactory.newRecordInstance(Priority.class);
|
||||||
|
@ -3295,7 +3295,7 @@ public void testBasicDRFAssignment() throws Exception {
|
|||||||
scheduler.start();
|
scheduler.start();
|
||||||
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
||||||
|
|
||||||
RMNode node = MockNodes.newNodeInfo(1, BuilderUtils.newResource(8192, 5));
|
RMNode node = MockNodes.newNodeInfo(1, Resources.createResource(8192, 5));
|
||||||
NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
||||||
scheduler.handle(nodeEvent);
|
scheduler.handle(nodeEvent);
|
||||||
|
|
||||||
@ -3337,7 +3337,7 @@ public void testBasicDRFWithQueues() throws Exception {
|
|||||||
scheduler.start();
|
scheduler.start();
|
||||||
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
||||||
|
|
||||||
RMNode node = MockNodes.newNodeInfo(1, BuilderUtils.newResource(8192, 7),
|
RMNode node = MockNodes.newNodeInfo(1, Resources.createResource(8192, 7),
|
||||||
1, "127.0.0.1");
|
1, "127.0.0.1");
|
||||||
NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
||||||
scheduler.handle(nodeEvent);
|
scheduler.handle(nodeEvent);
|
||||||
@ -3375,7 +3375,7 @@ public void testDRFHierarchicalQueues() throws Exception {
|
|||||||
scheduler.start();
|
scheduler.start();
|
||||||
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
||||||
|
|
||||||
RMNode node = MockNodes.newNodeInfo(1, BuilderUtils.newResource(12288, 12),
|
RMNode node = MockNodes.newNodeInfo(1, Resources.createResource(12288, 12),
|
||||||
1, "127.0.0.1");
|
1, "127.0.0.1");
|
||||||
NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
||||||
scheduler.handle(nodeEvent);
|
scheduler.handle(nodeEvent);
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ResourceInformation;
|
import org.apache.hadoop.yarn.api.records.ResourceInformation;
|
||||||
import org.apache.hadoop.yarn.api.records.impl.LightWeightResource;
|
import org.apache.hadoop.yarn.api.records.impl.LightWeightResource;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.UnitsConversionUtil;
|
import org.apache.hadoop.yarn.util.UnitsConversionUtil;
|
||||||
import org.apache.hadoop.yarn.util.resource.CustomResourceTypesConfigurationProvider;
|
import org.apache.hadoop.yarn.util.resource.CustomResourceTypesConfigurationProvider;
|
||||||
import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
|
import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
|
||||||
@ -125,8 +124,8 @@ private void expectNegativeValueOfResource(String resource) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseResourceConfigValue() throws Exception {
|
public void testParseResourceConfigValue() throws Exception {
|
||||||
Resource expected = BuilderUtils.newResource(5 * 1024, 2);
|
Resource expected = Resources.createResource(5 * 1024, 2);
|
||||||
Resource clusterResource = BuilderUtils.newResource(10 * 1024, 4);
|
Resource clusterResource = Resources.createResource(10 * 1024, 4);
|
||||||
|
|
||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
parseResourceConfigValue("5120 mb 2 vcores").getResource());
|
parseResourceConfigValue("5120 mb 2 vcores").getResource());
|
||||||
@ -155,13 +154,13 @@ public void testParseResourceConfigValue() throws Exception {
|
|||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
parseResourceConfigValue("50% Memory, 50% CpU").
|
parseResourceConfigValue("50% Memory, 50% CpU").
|
||||||
getResource(clusterResource));
|
getResource(clusterResource));
|
||||||
assertEquals(BuilderUtils.newResource(5 * 1024, 4),
|
assertEquals(Resources.createResource(5 * 1024, 4),
|
||||||
parseResourceConfigValue("50% memory, 100% cpu").
|
parseResourceConfigValue("50% memory, 100% cpu").
|
||||||
getResource(clusterResource));
|
getResource(clusterResource));
|
||||||
assertEquals(BuilderUtils.newResource(5 * 1024, 4),
|
assertEquals(Resources.createResource(5 * 1024, 4),
|
||||||
parseResourceConfigValue(" 100% cpu, 50% memory").
|
parseResourceConfigValue(" 100% cpu, 50% memory").
|
||||||
getResource(clusterResource));
|
getResource(clusterResource));
|
||||||
assertEquals(BuilderUtils.newResource(5 * 1024, 0),
|
assertEquals(Resources.createResource(5 * 1024, 0),
|
||||||
parseResourceConfigValue("50% memory, 0% cpu").
|
parseResourceConfigValue("50% memory, 0% cpu").
|
||||||
getResource(clusterResource));
|
getResource(clusterResource));
|
||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
@ -176,7 +175,7 @@ public void testParseResourceConfigValue() throws Exception {
|
|||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
parseResourceConfigValue("50.% memory, 50.% cpu").
|
parseResourceConfigValue("50.% memory, 50.% cpu").
|
||||||
getResource(clusterResource));
|
getResource(clusterResource));
|
||||||
assertEquals(BuilderUtils.newResource((int)(1024 * 10 * 0.109), 2),
|
assertEquals(Resources.createResource((int)(1024 * 10 * 0.109), 2),
|
||||||
parseResourceConfigValue("10.9% memory, 50.6% cpu").
|
parseResourceConfigValue("10.9% memory, 50.6% cpu").
|
||||||
getResource(clusterResource));
|
getResource(clusterResource));
|
||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
@ -187,8 +186,8 @@ public void testParseResourceConfigValue() throws Exception {
|
|||||||
conf.set(YarnConfiguration.RESOURCE_TYPES, "test1");
|
conf.set(YarnConfiguration.RESOURCE_TYPES, "test1");
|
||||||
ResourceUtils.resetResourceTypes(conf);
|
ResourceUtils.resetResourceTypes(conf);
|
||||||
|
|
||||||
clusterResource = BuilderUtils.newResource(10 * 1024, 4);
|
clusterResource = Resources.createResource(10 * 1024, 4);
|
||||||
expected = BuilderUtils.newResource(5 * 1024, 2);
|
expected = Resources.createResource(5 * 1024, 2);
|
||||||
expected.setResourceValue("test1", Long.MAX_VALUE);
|
expected.setResourceValue("test1", Long.MAX_VALUE);
|
||||||
|
|
||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
@ -233,7 +232,7 @@ public void testParseResourceConfigValue() throws Exception {
|
|||||||
parseResourceConfigValue(" vcores = 2 , memory-mb = 5120 , "
|
parseResourceConfigValue(" vcores = 2 , memory-mb = 5120 , "
|
||||||
+ "test1 = 4 ").getResource());
|
+ "test1 = 4 ").getResource());
|
||||||
|
|
||||||
expected = BuilderUtils.newResource(4 * 1024, 3);
|
expected = Resources.createResource(4 * 1024, 3);
|
||||||
expected.setResourceValue("test1", 8L);
|
expected.setResourceValue("test1", 8L);
|
||||||
|
|
||||||
assertEquals(expected,
|
assertEquals(expected,
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.Schedulable;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.Schedulable;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy.DominantResourceFairnessComparatorN;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy.DominantResourceFairnessComparatorN;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy.DominantResourceFairnessComparator2;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy.DominantResourceFairnessComparator2;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@ -84,8 +83,8 @@ private Schedulable createSchedulable(int memUsage, int cpuUsage,
|
|||||||
|
|
||||||
private Schedulable createSchedulable(int memUsage, int cpuUsage,
|
private Schedulable createSchedulable(int memUsage, int cpuUsage,
|
||||||
float weights, int minMemShare, int minCpuShare) {
|
float weights, int minMemShare, int minCpuShare) {
|
||||||
Resource usage = BuilderUtils.newResource(memUsage, cpuUsage);
|
Resource usage = Resources.createResource(memUsage, cpuUsage);
|
||||||
Resource minShare = BuilderUtils.newResource(minMemShare, minCpuShare);
|
Resource minShare = Resources.createResource(minMemShare, minCpuShare);
|
||||||
return new FakeSchedulable(minShare,
|
return new FakeSchedulable(minShare,
|
||||||
Resources.createResource(Integer.MAX_VALUE, Integer.MAX_VALUE),
|
Resources.createResource(Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||||
weights, Resources.none(), usage, 0l);
|
weights, Resources.none(), usage, 0l);
|
||||||
|
@ -955,10 +955,10 @@ public void testBlackListNodes() throws Exception {
|
|||||||
// Ask for a 1 GB container for app 1
|
// Ask for a 1 GB container for app 1
|
||||||
List<ResourceRequest> ask1 = new ArrayList<ResourceRequest>();
|
List<ResourceRequest> ask1 = new ArrayList<ResourceRequest>();
|
||||||
ask1.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
ask1.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
||||||
"rack1", BuilderUtils.newResource(GB, 1), 1,
|
"rack1", Resources.createResource(GB), 1,
|
||||||
RMNodeLabelsManager.NO_LABEL));
|
RMNodeLabelsManager.NO_LABEL));
|
||||||
ask1.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
ask1.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
||||||
ResourceRequest.ANY, BuilderUtils.newResource(GB, 1), 1,
|
ResourceRequest.ANY, Resources.createResource(GB), 1,
|
||||||
RMNodeLabelsManager.NO_LABEL));
|
RMNodeLabelsManager.NO_LABEL));
|
||||||
fs.allocate(appAttemptId1, ask1, null, emptyId,
|
fs.allocate(appAttemptId1, ask1, null, emptyId,
|
||||||
Collections.singletonList(host_1_0), null, NULL_UPDATE_REQUESTS);
|
Collections.singletonList(host_1_0), null, NULL_UPDATE_REQUESTS);
|
||||||
@ -991,7 +991,7 @@ public void testBlackListNodes() throws Exception {
|
|||||||
// this time, rack0 is also in blacklist, so only host_1_1 is available to
|
// this time, rack0 is also in blacklist, so only host_1_1 is available to
|
||||||
// be assigned
|
// be assigned
|
||||||
ask2.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
ask2.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
||||||
ResourceRequest.ANY, BuilderUtils.newResource(GB, 1), 1));
|
ResourceRequest.ANY, Resources.createResource(GB), 1));
|
||||||
fs.allocate(appAttemptId1, ask2, null, emptyId,
|
fs.allocate(appAttemptId1, ask2, null, emptyId,
|
||||||
Collections.singletonList("rack0"), null, NULL_UPDATE_REQUESTS);
|
Collections.singletonList("rack0"), null, NULL_UPDATE_REQUESTS);
|
||||||
|
|
||||||
@ -1077,14 +1077,14 @@ public void testHeadroom() throws Exception {
|
|||||||
// Ask for a 1 GB container for app 1
|
// Ask for a 1 GB container for app 1
|
||||||
List<ResourceRequest> ask1 = new ArrayList<ResourceRequest>();
|
List<ResourceRequest> ask1 = new ArrayList<ResourceRequest>();
|
||||||
ask1.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
ask1.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
||||||
ResourceRequest.ANY, BuilderUtils.newResource(GB, 1), 1));
|
ResourceRequest.ANY, Resources.createResource(GB), 1));
|
||||||
fs.allocate(appAttemptId1, ask1, null, emptyId,
|
fs.allocate(appAttemptId1, ask1, null, emptyId,
|
||||||
null, null, NULL_UPDATE_REQUESTS);
|
null, null, NULL_UPDATE_REQUESTS);
|
||||||
|
|
||||||
// Ask for a 2 GB container for app 2
|
// Ask for a 2 GB container for app 2
|
||||||
List<ResourceRequest> ask2 = new ArrayList<ResourceRequest>();
|
List<ResourceRequest> ask2 = new ArrayList<ResourceRequest>();
|
||||||
ask2.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
ask2.add(BuilderUtils.newResourceRequest(BuilderUtils.newPriority(0),
|
||||||
ResourceRequest.ANY, BuilderUtils.newResource(2 * GB, 1), 1));
|
ResourceRequest.ANY, Resources.createResource(2 * GB), 1));
|
||||||
fs.allocate(appAttemptId2, ask2, null, emptyId,
|
fs.allocate(appAttemptId2, ask2, null, emptyId,
|
||||||
null, null, NULL_UPDATE_REQUESTS);
|
null, null, NULL_UPDATE_REQUESTS);
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ResourceOption;
|
import org.apache.hadoop.yarn.api.records.ResourceOption;
|
||||||
import org.apache.hadoop.yarn.api.records.ResourceUtilization;
|
import org.apache.hadoop.yarn.api.records.ResourceUtilization;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
||||||
import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus;
|
import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus;
|
||||||
import org.apache.hadoop.yarn.server.api.records.NodeStatus;
|
import org.apache.hadoop.yarn.server.api.records.NodeStatus;
|
||||||
import org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus;
|
import org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus;
|
||||||
@ -83,6 +82,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceOptionInfo;
|
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceOptionInfo;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
import org.apache.hadoop.yarn.util.RackResolver;
|
import org.apache.hadoop.yarn.util.RackResolver;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
||||||
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
|
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
|
||||||
import org.apache.hadoop.yarn.webapp.GuiceServletConfig;
|
import org.apache.hadoop.yarn.webapp.GuiceServletConfig;
|
||||||
@ -1006,7 +1006,7 @@ public void testNodeAttributesInfo() throws Exception {
|
|||||||
RegisterNodeManagerRequest registerReq =
|
RegisterNodeManagerRequest registerReq =
|
||||||
Records.newRecord(RegisterNodeManagerRequest.class);
|
Records.newRecord(RegisterNodeManagerRequest.class);
|
||||||
NodeId nodeId = NodeId.newInstance("host1", 1234);
|
NodeId nodeId = NodeId.newInstance("host1", 1234);
|
||||||
Resource capability = BuilderUtils.newResource(1024, 1);
|
Resource capability = Resources.createResource(1024);
|
||||||
registerReq.setResource(capability);
|
registerReq.setResource(capability);
|
||||||
registerReq.setNodeId(nodeId);
|
registerReq.setNodeId(nodeId);
|
||||||
registerReq.setHttpPort(1234);
|
registerReq.setHttpPort(1234);
|
||||||
|
Loading…
Reference in New Issue
Block a user