当前位置: 首页>>代码示例>>Java>>正文


Java DeletionService.delete方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.nodemanager.DeletionService.delete方法的典型用法代码示例。如果您正苦于以下问题:Java DeletionService.delete方法的具体用法?Java DeletionService.delete怎么用?Java DeletionService.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.nodemanager.DeletionService的用法示例。


在下文中一共展示了DeletionService.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteLocalDir

import org.apache.hadoop.yarn.server.nodemanager.DeletionService; //导入方法依赖的package包/类
private void deleteLocalDir(FileContext lfs, DeletionService del,
    String localDir) throws IOException {
  RemoteIterator<FileStatus> fileStatus = lfs.listStatus(new Path(localDir));
  if (fileStatus != null) {
    while (fileStatus.hasNext()) {
      FileStatus status = fileStatus.next();
      try {
        if (status.getPath().getName().matches(".*" +
            ContainerLocalizer.USERCACHE + "_DEL_.*")) {
          LOG.info("usercache path : " + status.getPath().toString());
          cleanUpFilesPerUserDir(lfs, del, status.getPath());
        } else if (status.getPath().getName()
            .matches(".*" + NM_PRIVATE_DIR + "_DEL_.*")
            ||
            status.getPath().getName()
                .matches(".*" + ContainerLocalizer.FILECACHE + "_DEL_.*")) {
          del.delete(null, status.getPath(), new Path[] {});
        }
      } catch (IOException ex) {
        // Do nothing, just give the warning
        LOG.warn("Failed to delete this local Directory: " +
            status.getPath().getName());
      }
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:ResourceLocalizationService.java

示例2: remove

import org.apache.hadoop.yarn.server.nodemanager.DeletionService; //导入方法依赖的package包/类
@Override
 public boolean remove(LocalizedResource rem, DeletionService delService) {
// current synchronization guaranteed by crude RLS event for cleanup
   LocalizedResource rsrc = localrsrc.get(rem.getRequest());
   if (null == rsrc) {
     LOG.error("Attempt to remove absent resource: " + rem.getRequest()
         + " from " + getUser());
     return true;
   }
   if (rsrc.getRefCount() > 0
       || ResourceState.DOWNLOADING.equals(rsrc.getState()) || rsrc != rem) {
     // internal error
     LOG.error("Attempt to remove resource: " + rsrc
         + " with non-zero refcount");
     return false;
   } else { // ResourceState is LOCALIZED or INIT
     if (ResourceState.LOCALIZED.equals(rsrc.getState())) {
       delService.delete(getUser(), getPathToDelete(rsrc.getLocalPath()));
     }
     removeResource(rem.getRequest());
     LOG.info("Removed " + rsrc.getLocalPath() + " from localized cache");
     return true;
   }
 }
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:LocalResourcesTrackerImpl.java

示例3: remove

import org.apache.hadoop.yarn.server.nodemanager.DeletionService; //导入方法依赖的package包/类
@Override
 public boolean remove(LocalizedResource rem, DeletionService delService) {
// current synchronization guaranteed by crude RLS event for cleanup
   LocalizedResource rsrc = localrsrc.get(rem.getRequest());
   if (null == rsrc) {
     LOG.error("Attempt to remove absent resource: " + rem.getRequest()
         + " from " + getUser());
     return true;
   }
   if (rsrc.getRefCount() > 0
       || ResourceState.DOWNLOADING.equals(rsrc.getState()) || rsrc != rem) {
     // internal error
     LOG.error("Attempt to remove resource: " + rsrc
         + " with non-zero refcount");
     return false;
   } else { // ResourceState is LOCALIZED or INIT
     localrsrc.remove(rem.getRequest());
     if (ResourceState.LOCALIZED.equals(rsrc.getState())) {
       delService.delete(getUser(), getPathToDelete(rsrc.getLocalPath()));
     }
     decrementFileCountForLocalCacheDirectory(rem.getRequest(), rsrc);
     return true;
   }
 }
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:25,代码来源:LocalResourcesTrackerImpl.java

示例4: deleteAppLogDir

import org.apache.hadoop.yarn.server.nodemanager.DeletionService; //导入方法依赖的package包/类
private void deleteAppLogDir(FileContext fs, DeletionService del,
    String logDir) throws IOException {
  RemoteIterator<FileStatus> fileStatuses =
      fs.listStatus(new Path(logDir));
  if (fileStatuses != null) {
    while (fileStatuses.hasNext()) {
      FileStatus fileStatus = fileStatuses.next();
      String appName = fileStatus.getPath().getName();
      if (appName.matches("^application_\\d+_\\d+_DEL_\\d+$")) {
        LOG.info("delete app log dir," + appName);
        del.delete(null, fileStatus.getPath());
      }
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:16,代码来源:ResourceLocalizationService.java

示例5: getPathForLocalization

import org.apache.hadoop.yarn.server.nodemanager.DeletionService; //导入方法依赖的package包/类
/**
 * @return {@link Path} absolute path for localization which includes local
 *         directory path and the relative hierarchical path (if use local
 *         cache directory manager is enabled)
 * 
 * @param {@link LocalResourceRequest} Resource localization request to
 *        localize the resource.
 * @param {@link Path} local directory path
 * @param {@link DeletionService} Deletion Service to delete existing
 *        path for localization.
 */
@Override
public Path getPathForLocalization(LocalResourceRequest req,
    Path localDirPath, DeletionService delService) {
  Path rPath = localDirPath;
  if (useLocalCacheDirectoryManager && localDirPath != null) {

    if (!directoryManagers.containsKey(localDirPath)) {
      directoryManagers.putIfAbsent(localDirPath,
        new LocalCacheDirectoryManager(conf));
    }
    LocalCacheDirectoryManager dir = directoryManagers.get(localDirPath);

    rPath = localDirPath;
    String hierarchicalPath = dir.getRelativePathForLocalization();
    // For most of the scenarios we will get root path only which
    // is an empty string
    if (!hierarchicalPath.isEmpty()) {
      rPath = new Path(localDirPath, hierarchicalPath);
    }
    inProgressLocalResourcesMap.put(req, rPath);
  }

  while (true) {
    Path uniquePath = new Path(rPath,
        Long.toString(uniqueNumberGenerator.incrementAndGet()));
    File file = new File(uniquePath.toUri().getRawPath());
    if (!file.exists()) {
      rPath = uniquePath;
      break;
    }
    // If the directory already exists, delete it and move to next one.
    LOG.warn("Directory " + uniquePath + " already exists, " +
        "try next one.");
    if (delService != null) {
      delService.delete(getUser(), uniquePath);
    }
  }

  Path localPath = new Path(rPath, req.getPath().getName());
  LocalizedResource rsrc = localrsrc.get(req);
  rsrc.setLocalPath(localPath);
  LocalResource lr = LocalResource.newInstance(req.getResource(),
      req.getType(), req.getVisibility(), req.getSize(),
      req.getTimestamp());
  try {
    stateStore.startResourceLocalization(user, appId,
        ((LocalResourcePBImpl) lr).getProto(), localPath);
  } catch (IOException e) {
    LOG.error("Unable to record localization start for " + rsrc, e);
  }
  return rPath;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:64,代码来源:LocalResourcesTrackerImpl.java


注:本文中的org.apache.hadoop.yarn.server.nodemanager.DeletionService.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。