YARN-8898. [Addendum] Improve NodeManager#TestFederationInterceptor Setup Code (#5732)
This commit is contained in:
parent
a409d52ef8
commit
2794fe264b
@ -40,6 +40,8 @@
|
||||
import org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
import org.apache.hadoop.yarn.api.records.ReservationId;
|
||||
import org.apache.hadoop.yarn.api.records.Priority;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
|
||||
@ -668,4 +670,17 @@ public void setExpiredHeartbeat(SubClusterId subClusterId, long heartBearTime)
|
||||
SubClusterInfo subClusterInfo = membership.get(subClusterId);
|
||||
subClusterInfo.setLastHeartBeat(heartBearTime);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setApplicationContext(String subClusterId, ApplicationId applicationId,
|
||||
long createTime) {
|
||||
ApplicationSubmissionContext context =
|
||||
ApplicationSubmissionContext.newInstance(applicationId, "test", "default",
|
||||
Priority.newInstance(0), null, true, true,
|
||||
2, Resource.newInstance(10, 2), "test");
|
||||
SubClusterId homeSubClusterId = SubClusterId.newInstance(subClusterId);
|
||||
ApplicationHomeSubCluster applicationHomeSubCluster =
|
||||
ApplicationHomeSubCluster.newInstance(applicationId, createTime, homeSubClusterId, context);
|
||||
this.applications.put(applicationId, applicationHomeSubCluster);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
import org.apache.hadoop.registry.client.impl.FSRegistryOperationsService;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.test.LambdaTestUtils;
|
||||
import org.apache.hadoop.util.Time;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
|
||||
@ -130,6 +131,8 @@ public void setUp() throws IOException {
|
||||
|
||||
testAppId = 1;
|
||||
attemptId = getApplicationAttemptId(testAppId);
|
||||
stateStore.setApplicationContext(HOME_SC_ID, attemptId.getApplicationId(), Time.now());
|
||||
|
||||
nmContext =
|
||||
new NMContext(null, null, null, null, nmStateStore, false, getConf());
|
||||
interceptor.init(new AMRMProxyApplicationContextImpl(nmContext, getConf(),
|
||||
|
Loading…
Reference in New Issue
Block a user