Search in sources :

Example 1 with DirsChangeListener

use of org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.DirsChangeListener in project hadoop by apache.

the class ResourceLocalizationService method serviceInit.

@Override
public void serviceInit(Configuration conf) throws Exception {
    this.validateConf(conf);
    this.publicRsrc = new LocalResourcesTrackerImpl(null, null, dispatcher, true, conf, stateStore, dirsHandler);
    this.recordFactory = RecordFactoryProvider.getRecordFactory(conf);
    try {
        lfs = getLocalFileContext(conf);
        lfs.setUMask(new FsPermission((short) FsPermission.DEFAULT_UMASK));
        if (!stateStore.canRecover() || stateStore.isNewlyCreated()) {
            cleanUpLocalDirs(lfs, delService);
            cleanupLogDirs(lfs, delService);
            initializeLocalDirs(lfs);
            initializeLogDirs(lfs);
        }
    } catch (Exception e) {
        throw new YarnRuntimeException("Failed to initialize LocalizationService", e);
    }
    diskValidator = DiskValidatorFactory.getInstance(conf.get(YarnConfiguration.DISK_VALIDATOR));
    LOG.info("Disk Validator: " + YarnConfiguration.DISK_VALIDATOR + " is loaded.");
    cacheTargetSize = conf.getLong(YarnConfiguration.NM_LOCALIZER_CACHE_TARGET_SIZE_MB, YarnConfiguration.DEFAULT_NM_LOCALIZER_CACHE_TARGET_SIZE_MB) << 20;
    cacheCleanupPeriod = conf.getLong(YarnConfiguration.NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS, YarnConfiguration.DEFAULT_NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS);
    localizationServerAddress = conf.getSocketAddr(YarnConfiguration.NM_BIND_HOST, YarnConfiguration.NM_LOCALIZER_ADDRESS, YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS, YarnConfiguration.DEFAULT_NM_LOCALIZER_PORT);
    localizerTracker = createLocalizerTracker(conf);
    addService(localizerTracker);
    dispatcher.register(LocalizerEventType.class, localizerTracker);
    localDirsChangeListener = new DirsChangeListener() {

        @Override
        public void onDirsChanged() {
            checkAndInitializeLocalDirs();
        }
    };
    logDirsChangeListener = new DirsChangeListener() {

        @Override
        public void onDirsChanged() {
            initializeLogDirs(lfs);
        }
    };
    super.serviceInit(conf);
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) DirsChangeListener(org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.DirsChangeListener) FsPermission(org.apache.hadoop.fs.permission.FsPermission) CancellationException(java.util.concurrent.CancellationException) FileAlreadyExistsException(org.apache.hadoop.fs.FileAlreadyExistsException) IOException(java.io.IOException) YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) ExecutionException(java.util.concurrent.ExecutionException) UnsupportedFileSystemException(org.apache.hadoop.fs.UnsupportedFileSystemException) URISyntaxException(java.net.URISyntaxException) FileNotFoundException(java.io.FileNotFoundException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 CancellationException (java.util.concurrent.CancellationException)1 ExecutionException (java.util.concurrent.ExecutionException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 FileAlreadyExistsException (org.apache.hadoop.fs.FileAlreadyExistsException)1 UnsupportedFileSystemException (org.apache.hadoop.fs.UnsupportedFileSystemException)1 FsPermission (org.apache.hadoop.fs.permission.FsPermission)1 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)1 DirsChangeListener (org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.DirsChangeListener)1