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


Java DeletionAsUserContext.getBasedirs方法代码示例

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


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

示例1: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx)
  throws IOException, InterruptedException {
  Path subDir = ctx.getSubDir();
  List<Path> baseDirs = ctx.getBasedirs();

  if (baseDirs == null || baseDirs.size() == 0) {
    LOG.info("Deleting absolute path : " + subDir);
    if (!lfs.delete(subDir, true)) {
      //Maybe retry
      LOG.warn("delete returned false for path: [" + subDir + "]");
    }
    return;
  }
  for (Path baseDir : baseDirs) {
    Path del = subDir == null ? baseDir : new Path(baseDir, subDir);
    LOG.info("Deleting path : " + del);
    if (!lfs.delete(del, true)) {
      LOG.warn("delete returned false for path: [" + del + "]");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:DockerContainerExecutor.java

示例2: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx)
    throws IOException, InterruptedException {
  Path subDir = ctx.getSubDir();
  List<Path> baseDirs = ctx.getBasedirs();

  if (baseDirs == null || baseDirs.size() == 0) {
    LOG.info("Deleting absolute path : " + subDir);
    if (!lfs.delete(subDir, true)) {
      //Maybe retry
      LOG.warn("delete returned false for path: [" + subDir + "]");
    }
    return;
  }
  for (Path baseDir : baseDirs) {
    Path del = subDir == null ? baseDir : new Path(baseDir, subDir);
    LOG.info("Deleting path : " + del);
    if (!lfs.delete(del, true)) {
      LOG.warn("delete returned false for path: [" + del + "]");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:DefaultContainerExecutor.java

示例3: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx)
    throws IOException, InterruptedException {
  String user = ctx.getUser();
  Path subDir = ctx.getSubDir();
  List<Path> basedirs = ctx.getBasedirs();

  if ((Long.parseLong(subDir.getName()) % 2) == 0) {
    assertNull(user);
  } else {
    assertEquals("dingo", user);
  }

  DeletionAsUserContext.Builder builder = new DeletionAsUserContext
      .Builder()
      .setUser(user)
      .setSubDir(subDir);

  if (basedirs != null) {
    builder.setBasedirs(basedirs.toArray(new Path[basedirs.size()]));
  }

  super.deleteAsUser(builder.build());
  assertFalse(lfs.util().exists(subDir));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestDeletionService.java

示例4: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx)
  throws IOException, InterruptedException {
  Path subDir = ctx.getSubDir();
  List<Path> baseDirs = ctx.getBasedirs();

  if (baseDirs == null || baseDirs.size() == 0) {
    LOG.info("Deleting absolute path : " + subDir);
    if (!lfs.delete(subDir, true)) {
      //Maybe retry
      LOG.warn("delete returned false for path: [" + subDir + "]");
    }
    return;
  }
  for (Path baseDir : baseDirs) {
    Path del = subDir == null ? baseDir : new Path(baseDir, subDir);
    LOG.info("Deleting path : " + del);
    try {
      if (!lfs.delete(del, true)) {
        LOG.warn("delete returned false for path: [" + del + "]");
      }
    } catch (FileNotFoundException e) {
      continue;
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:DockerContainerExecutor.java

示例5: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx)
    throws IOException, InterruptedException {
  Path subDir = ctx.getSubDir();
  List<Path> baseDirs = ctx.getBasedirs();

  if (baseDirs == null || baseDirs.size() == 0) {
    LOG.info("Deleting absolute path : " + subDir);
    if (!lfs.delete(subDir, true)) {
      //Maybe retry
      LOG.warn("delete returned false for path: [" + subDir + "]");
    }
    return;
  }
  for (Path baseDir : baseDirs) {
    Path del = subDir == null ? baseDir : new Path(baseDir, subDir);
    LOG.info("Deleting path : " + del);
    try {
      if (!lfs.delete(del, true)) {
        LOG.warn("delete returned false for path: [" + del + "]");
      }
    } catch (FileNotFoundException e) {
      continue;
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:DefaultContainerExecutor.java

示例6: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx) {
  String user = ctx.getUser();
  Path dir = ctx.getSubDir();
  List<Path> baseDirs = ctx.getBasedirs();

  verifyUsernamePattern(user);

  String runAsUser = getRunAsUser(user);
  String dirString = dir == null ? "" : dir.toUri().getPath();

  PrivilegedOperation deleteAsUserOp = new PrivilegedOperation(
      PrivilegedOperation.OperationType.DELETE_AS_USER, (String) null);

  deleteAsUserOp.appendArgs(
      runAsUser,
      user,
      Integer.toString(PrivilegedOperation.
          RunAsUserCommand.DELETE_AS_USER.getValue()),
      dirString);

  List<String> pathsToDelete = new ArrayList<String>();
  if (baseDirs == null || baseDirs.size() == 0) {
    LOG.info("Deleting absolute path : " + dir);
    pathsToDelete.add(dirString);
  } else {
    for (Path baseDir : baseDirs) {
      Path del = dir == null ? baseDir : new Path(baseDir, dir);
      LOG.info("Deleting path : " + del);
      pathsToDelete.add(del.toString());
      deleteAsUserOp.appendArgs(baseDir.toUri().getPath());
    }
  }

  try {
    Configuration conf = super.getConf();
    PrivilegedOperationExecutor privilegedOperationExecutor =
        PrivilegedOperationExecutor.getInstance(conf);

    privilegedOperationExecutor.executePrivilegedOperation(deleteAsUserOp,
        false);
  }   catch (PrivilegedOperationException e) {
    int exitCode = e.getExitCode();
    LOG.error("DeleteAsUser for " + StringUtils.join(" ", pathsToDelete)
        + " returned with exit code: " + exitCode, e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:48,代码来源:LinuxContainerExecutor.java

示例7: deleteAsUser

import org.apache.hadoop.yarn.server.nodemanager.executor.DeletionAsUserContext; //导入方法依赖的package包/类
@Override
public void deleteAsUser(DeletionAsUserContext ctx) {
  String user = ctx.getUser();
  Path dir = ctx.getSubDir();
  List<Path> baseDirs = ctx.getBasedirs();

  verifyUsernamePattern(user);

  String runAsUser = getRunAsUser(user);
  String dirString = dir == null ? "" : dir.toUri().getPath();

  PrivilegedOperation deleteAsUserOp = new PrivilegedOperation(
      PrivilegedOperation.OperationType.DELETE_AS_USER, (String) null);

  deleteAsUserOp.appendArgs(
      runAsUser,
      user,
      Integer.toString(PrivilegedOperation.
          RunAsUserCommand.DELETE_AS_USER.getValue()),
      dirString);

  List<String> pathsToDelete = new ArrayList<String>();
  if (baseDirs == null || baseDirs.size() == 0) {
    LOG.info("Deleting absolute path : " + dir);
    pathsToDelete.add(dirString);
  } else {
    for (Path baseDir : baseDirs) {
      Path del = dir == null ? baseDir : new Path(baseDir, dir);
      LOG.info("Deleting path : " + del);
      pathsToDelete.add(del.toString());
      deleteAsUserOp.appendArgs(baseDir.toUri().getPath());
    }
  }

  try {
    Configuration conf = super.getConf();
    PrivilegedOperationExecutor privilegedOperationExecutor =
        getPrivilegedOperationExecutor();

    privilegedOperationExecutor.executePrivilegedOperation(deleteAsUserOp,
        false);
  }   catch (PrivilegedOperationException e) {
    int exitCode = e.getExitCode();
    LOG.error("DeleteAsUser for " + StringUtils.join(" ", pathsToDelete)
        + " returned with exit code: " + exitCode, e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:48,代码来源:LinuxContainerExecutor.java


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