Search in sources :

Example 21 with AbstractYarnScheduler

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler 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);
}
Also used : AbstractYarnScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler) OpportunisticContainerContext(org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerContext) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) SchedulerApplicationAttempt(org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt) OpportunisticContainerAllocator(org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator)

Example 22 with AbstractYarnScheduler

use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler 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;
}
Also used : AbstractYarnScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler) SchedulerApplicationAttempt(org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt)

Aggregations

AbstractYarnScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler)22 Test (org.junit.Test)14 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)11 SchedulerApplicationAttempt (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt)11 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)7 NMContainerStatus (org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus)7 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)7 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)6 MemoryRMStateStore (org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore)6 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)5 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)5 TestSecurityMockRM (org.apache.hadoop.yarn.server.resourcemanager.TestRMRestart.TestSecurityMockRM)5 Resource (org.apache.hadoop.yarn.api.records.Resource)4 SchedulerApplication (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication)4 SchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode)4 Configuration (org.apache.hadoop.conf.Configuration)3 Container (org.apache.hadoop.yarn.api.records.Container)3 RMAppAttempt (org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt)3 CapacitySchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration)3 DominantResourceCalculator (org.apache.hadoop.yarn.util.resource.DominantResourceCalculator)3