Source:
public void start() { LOG.info("Starting the container process manager"); int containerRetryCount = clusterManagerConfig.getContainerRetryCount(); if (containerRetryCount > -1) { LOG.info("Max retries on restarting failed containers: {}", containerRetryCount); } else { LOG.info("Infinite retries on restarting failed containers"); } if (jvmMetrics != null) { jvmMetrics.start(); } if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.start()); } if (diagnosticsManager.isDefined()) { diagnosticsManager.get().start(); } if (jobConfig.getApplicationMasterHighAvailabilityEnabled()) { LOG.info( "Set neededProcessors prior to starting clusterResourceManager because it gets running containres from prev attempts in AM HA."); state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); } LOG.info("Starting the cluster resource manager"); clusterResourceManager.start(); if (!jobConfig.getApplicationMasterHighAvailabilityEnabled()) { state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); } LocalityModel localityModel = localityManager.readLocality(); Map<String, String> processorToHost = new HashMap<>(); state.jobModelManager.jobModel().getContainers().keySet().forEach((containerId) -> { String host = Optional.ofNullable(localityModel.getProcessorLocality(containerId)) .map(ProcessorLocality::host) .filter(StringUtils::isNotBlank) .orElse(null); processorToHost.put(containerId, host); }); if (jobConfig.getApplicationMasterHighAvailabilityEnabled()) { state.runningProcessors.keySet().forEach(containerId -> { processorToHost.remove(containerId); state.neededProcessors.decrementAndGet(); }); } containerAllocator.requestResources(processorToHost); LOG.info("Starting the container allocator thread"); allocatorThread.start(); LOG.info("Starting the container process manager"); }

Target:
public void start() { LOG.info("Starting the container process manager"); int containerRetryCount = clusterManagerConfig.getContainerRetryCount(); if (containerRetryCount > -1) { LOG.info("Max retries on restarting failed containers: {}", containerRetryCount); } else { LOG.info("Infinite retries on restarting failed containers"); } if (jvmMetrics != null) { jvmMetrics.start(); } if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.start()); } if (diagnosticsManager.isDefined()) { diagnosticsManager.get().start(); } state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); LOG.info("Starting the cluster resource manager"); clusterResourceManager.start(); LocalityModel localityModel = localityManager.readLocality(); Map<String, String> processorToHost = new HashMap<>(); state.jobModelManager.jobModel().getContainers().keySet().forEach((containerId) -> { String host = Optional.ofNullable(localityModel.getProcessorLocality(containerId)) .map(ProcessorLocality::host) .filter(StringUtils::isNotBlank) .orElse(null); processorToHost.put(containerId, host); }); if (jobConfig.getApplicationMasterHighAvailabilityEnabled()) { state.runningProcessors.keySet().forEach(processorToHost::remove); } containerAllocator.requestResources(processorToHost); LOG.info("Starting the container allocator thread"); allocatorThread.start(); LOG.info("Starting the container process manager"); }