Search in sources :

Example 11 with SchedulerApplicationAttempt

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);
}
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 12 with SchedulerApplicationAttempt

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

Aggregations

SchedulerApplicationAttempt (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt)12 AbstractYarnScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler)11 Test (org.junit.Test)6 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)4 NMContainerStatus (org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus)4 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)4 SchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode)4 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)3 Container (org.apache.hadoop.yarn.api.records.Container)3 Resource (org.apache.hadoop.yarn.api.records.Resource)3 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)3 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)3 TestSecurityMockRM (org.apache.hadoop.yarn.server.resourcemanager.TestRMRestart.TestSecurityMockRM)3 MemoryRMStateStore (org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore)3 RMAppAttempt (org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt)3 SchedulerApplication (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication)3 Configuration (org.apache.hadoop.conf.Configuration)2 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)2 RMNodeImpl (org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl)2 CapacitySchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration)2