use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt in project hadoop by apache.
the class OpportunisticContainerAllocatorAMService method registerApplicationMaster.
@Override
public RegisterApplicationMasterResponse registerApplicationMaster(RegisterApplicationMasterRequest request) throws YarnException, IOException {
final ApplicationAttemptId appAttemptId = getAppAttemptId();
SchedulerApplicationAttempt appAttempt = ((AbstractYarnScheduler) rmContext.getScheduler()).getApplicationAttempt(appAttemptId);
if (appAttempt.getOpportunisticContainerContext() == null) {
OpportunisticContainerContext opCtx = new OpportunisticContainerContext();
opCtx.setContainerIdGenerator(new OpportunisticContainerAllocator.ContainerIdGenerator() {
@Override
public long generateContainerId() {
return appAttempt.getAppSchedulingInfo().getNewContainerId();
}
});
int tokenExpiryInterval = getConfig().getInt(YarnConfiguration.RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS);
opCtx.updateAllocationParams(rmContext.getScheduler().getMinimumResourceCapability(), rmContext.getScheduler().getMaximumResourceCapability(), rmContext.getScheduler().getMinimumResourceCapability(), tokenExpiryInterval);
appAttempt.setOpportunisticContainerContext(opCtx);
}
return super.registerApplicationMaster(request);
}
use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt in project hadoop by apache.
the class RMAppAttemptImpl method getBlacklistedNodes.
@Override
public Set<String> getBlacklistedNodes() {
if (scheduler instanceof AbstractYarnScheduler) {
AbstractYarnScheduler ayScheduler = (AbstractYarnScheduler) scheduler;
SchedulerApplicationAttempt attempt = ayScheduler.getApplicationAttempt(applicationAttemptId);
if (attempt != null) {
return attempt.getBlacklistedNodes();
}
}
return Collections.EMPTY_SET;
}
Aggregations