public ResourceLocalizationService(Dispatcher dispatcher, ContainerExecutor exec, DeletionService delService, LocalDirsHandlerService dirsHandler, Context context) { super(ResourceLocalizationService.class.getName()); this.exec = exec; this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.cacheCleanup = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder() .setNameFormat("ResourceLocalizationService Cache Cleanup") .build()); this.stateStore = context.getNMStateStore(); this.nmContext = context; }
public ResourceLocalizationService(Dispatcher dispatcher, ContainerExecutor exec, DeletionService delService, LocalDirsHandlerService dirsHandler, Context context) { super(ResourceLocalizationService.class.getName()); this.exec = exec; this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.cacheCleanup = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder() .setNameFormat("ResourceLocalizationService Cache Cleanup") .build()); this.stateStore = context.getNMStateStore(); this.nmContext = context; }
public ResourceLocalizationService(Dispatcher dispatcher, ContainerExecutor exec, DeletionService delService, LocalDirsHandlerService dirsHandler, Context context) { super(ResourceLocalizationService.class.getName()); this.exec = exec; this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.cacheCleanup = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder() .setNameFormat("ResourceLocalizationService Cache Cleanup") .build()); this.stateStore = context.getNMStateStore(); this.nmContext = context; }
public ResourceLocalizationService(Dispatcher dispatcher, ContainerExecutor exec, DeletionService delService, LocalDirsHandlerService dirsHandler, Context context, NodeManagerMetrics metrics) { super(ResourceLocalizationService.class.getName()); this.exec = exec; this.dispatcher = dispatcher; this.delService = delService; this.dirsHandler = dirsHandler; this.cacheCleanup = new HadoopScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder() .setNameFormat("ResourceLocalizationService Cache Cleanup") .build()); this.stateStore = context.getNMStateStore(); this.nmContext = context; this.metrics = metrics; }
protected LogHandler createLogHandler(Configuration conf, Context context, DeletionService deletionService) { if (conf.getBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, YarnConfiguration.DEFAULT_LOG_AGGREGATION_ENABLED)) { return new LogAggregationService(this.dispatcher, context, deletionService, dirsHandler); } else { return new NonAggregatingLogHandler(this.dispatcher, deletionService, dirsHandler, context.getNMStateStore()); } }
protected LogHandler createLogHandler(Configuration conf, Context context, DeletionService deletionService) { if (conf.getBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, YarnConfiguration.DEFAULT_LOG_AGGREGATION_ENABLED)) { return new LogAggregationService(this.dispatcher, context, deletionService, dirsHandler); } else { return new NonAggregatingLogHandler(this.dispatcher, deletionService, dirsHandler, context.getNMStateStore()); } }
protected LogHandler createLogHandler(Configuration conf, Context context, DeletionService deletionService) { if (conf.getBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, YarnConfiguration.DEFAULT_LOG_AGGREGATION_ENABLED)) { return new LogAggregationService(this.dispatcher, context, deletionService, dirsHandler); } else { return new NonAggregatingLogHandler(this.dispatcher, deletionService, dirsHandler, context.getNMStateStore()); } }
protected LogHandler createLogHandler(Configuration conf, Context context, DeletionService deletionService) { if (conf.getBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, YarnConfiguration.DEFAULT_LOG_AGGREGATION_ENABLED)) { return new LogAggregationService(this.dispatcher, context, deletionService, dirsHandler); } else { return new NonAggregatingLogHandler(this.dispatcher, deletionService, dirsHandler, context.getNMStateStore()); } }
/** * A helper method for getting NM state store. * * @return the NMSS instance */ public NMStateStoreService getNMStateStore() { if (this.appContext == null || this.appContext.getNMCotext() == null) { return null; } return this.appContext.getNMCotext().getNMStateStore(); } }
@Override public void transition(ApplicationImpl app, ApplicationEvent event) { ApplicationId appId = event.getApplicationID(); app.context.getApplications().remove(appId); app.aclsManager.removeApplication(appId); try { app.context.getNMStateStore().removeApplication(appId); } catch (IOException e) { LOG.error("Unable to remove application from state store", e); } } }
@Override public void transition(ApplicationImpl app, ApplicationEvent event) { ApplicationId appId = event.getApplicationID(); app.context.getApplications().remove(appId); app.aclsManager.removeApplication(appId); try { app.context.getNMStateStore().removeApplication(appId); } catch (IOException e) { LOG.error("Unable to remove application from state store", e); } } }
@Override public void transition(ApplicationImpl app, ApplicationEvent event) { ApplicationId appId = event.getApplicationID(); app.context.getApplications().remove(appId); app.aclsManager.removeApplication(appId); try { app.context.getNMStateStore().removeApplication(appId); } catch (IOException e) { LOG.error("Unable to remove application from state store", e); } } }
protected void setContainerCompletedStatus(int exitCode) { ContainerId containerId = container.getContainerId(); completed.set(true); exec.deactivateContainer(containerId); try { if (!container.shouldRetry(exitCode)) { context.getNMStateStore().storeContainerCompleted(containerId, exitCode); } } catch (IOException e) { LOG.error("Unable to set exit code for container " + containerId); } }
private void recordContainerWorkDir(ContainerId containerId, String workDir) throws IOException{ container.setWorkDir(workDir); if (container.isRetryContextSet()) { context.getNMStateStore().storeContainerWorkDir(containerId, workDir); } }
private void recordContainerLogDir(ContainerId containerId, String logDir) throws IOException{ container.setLogDir(logDir); if (container.isRetryContextSet()) { context.getNMStateStore().storeContainerLogDir(containerId, logDir); } }
@Override public void transition( ContainerImpl container, ContainerEvent event) { UpdateContainerTokenEvent updateEvent = (UpdateContainerTokenEvent)event; // Update the container token container.setContainerTokenIdentifier(updateEvent.getUpdatedToken()); try { // Persist change in the state store. container.context.getNMStateStore() .storeContainerUpdateToken(container.containerId, container.getContainerTokenIdentifier()); } catch (IOException e) { LOG.warn("Could not store container [" + container.containerId + "] update..", e); } } }
@Override protected void serviceInit(Configuration conf) throws Exception { this.secretManager = new AMRMProxyTokenSecretManager(this.nmContext.getNMStateStore()); this.secretManager.init(conf); if (conf.getBoolean(YarnConfiguration.AMRM_PROXY_HA_ENABLED, YarnConfiguration.DEFAULT_AMRM_PROXY_HA_ENABLED)) { this.registry = FederationStateStoreFacade.createInstance(conf, YarnConfiguration.YARN_REGISTRY_CLASS, YarnConfiguration.DEFAULT_YARN_REGISTRY_CLASS, RegistryOperations.class); addService(this.registry); } super.serviceInit(conf); }
@SuppressWarnings("unchecked") private void recover() throws IOException, URISyntaxException { NMStateStoreService stateStore = context.getNMStateStore(); if (stateStore.canRecover()) { rsrcLocalizationSrvc.recoverLocalizedResources( stateStore.loadLocalizationState()); RecoveredApplicationsState appsState = stateStore.loadApplicationsState(); for (ContainerManagerApplicationProto proto : appsState.getApplications()) { recoverApplication(proto); } for (RecoveredContainerState rcs : stateStore.loadContainersState()) { recoverContainer(rcs); } } }
@SuppressWarnings("unchecked") private void recover() throws IOException, URISyntaxException { NMStateStoreService stateStore = context.getNMStateStore(); if (stateStore.canRecover()) { rsrcLocalizationSrvc.recoverLocalizedResources( stateStore.loadLocalizationState()); RecoveredApplicationsState appsState = stateStore.loadApplicationsState(); for (ContainerManagerApplicationProto proto : appsState.getApplications()) { recoverApplication(proto); } for (RecoveredContainerState rcs : stateStore.loadContainersState()) { recoverContainer(rcs); } } }
@SuppressWarnings("unchecked") private void recover() throws IOException, URISyntaxException { NMStateStoreService stateStore = context.getNMStateStore(); if (stateStore.canRecover()) { rsrcLocalizationSrvc.recoverLocalizedResources( stateStore.loadLocalizationState()); RecoveredApplicationsState appsState = stateStore.loadApplicationsState(); for (ContainerManagerApplicationProto proto : appsState.getApplications()) { recoverApplication(proto); } for (RecoveredContainerState rcs : stateStore.loadContainersState()) { recoverContainer(rcs); } } }