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


Java QueueACL类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.records.QueueACL的典型用法代码示例。如果您正苦于以下问题:Java QueueACL类的具体用法?Java QueueACL怎么用?Java QueueACL使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QueueACL类属于org.apache.hadoop.yarn.api.records包,在下文中一共展示了QueueACL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkReservationACLs

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
private String checkReservationACLs(String queueName, String auditConstant)
    throws YarnException {
  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    RMAuditLogger.logFailure("UNKNOWN", auditConstant, queueName,
        "ClientRMService", "Error getting UGI");
    throw RPCUtil.getRemoteException(ie);
  }
  // Check if user has access on the managed queue
  if (!queueACLsManager.checkAccess(callerUGI, QueueACL.SUBMIT_APPLICATIONS,
      queueName)) {
    RMAuditLogger.logFailure(
        callerUGI.getShortUserName(),
        auditConstant,
        "User doesn't have permissions to "
            + QueueACL.SUBMIT_APPLICATIONS.toString(), "ClientRMService",
        AuditConstants.UNAUTHORIZED_USER);
    throw RPCUtil.getRemoteException(new AccessControlException("User "
        + callerUGI.getShortUserName() + " cannot perform operation "
        + QueueACL.SUBMIT_APPLICATIONS.name() + " on queue" + queueName));
  }
  return callerUGI.getShortUserName();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:ClientRMService.java

示例2: AllocationConfiguration

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
public AllocationConfiguration(Configuration conf) {
  minQueueResources = new HashMap<String, Resource>();
  maxQueueResources = new HashMap<String, Resource>();
  queueWeights = new HashMap<String, ResourceWeights>();
  queueMaxApps = new HashMap<String, Integer>();
  userMaxApps = new HashMap<String, Integer>();
  queueMaxAMShares = new HashMap<String, Float>();
  userMaxAppsDefault = Integer.MAX_VALUE;
  queueMaxAppsDefault = Integer.MAX_VALUE;
  queueMaxAMShareDefault = 0.5f;
  queueAcls = new HashMap<String, Map<QueueACL, AccessControlList>>();
  minSharePreemptionTimeouts = new HashMap<String, Long>();
  fairSharePreemptionTimeouts = new HashMap<String, Long>();
  fairSharePreemptionThresholds = new HashMap<String, Float>();
  schedulingPolicies = new HashMap<String, SchedulingPolicy>();
  defaultSchedulingPolicy = SchedulingPolicy.DEFAULT_POLICY;
  reservableQueues = new HashSet<>();
  configuredQueues = new HashMap<FSQueueType, Set<String>>();
  for (FSQueueType queueType : FSQueueType.values()) {
    configuredQueues.put(queueType, new HashSet<String>());
  }
  placementPolicy = QueuePlacementPolicy.fromConfiguration(conf,
      configuredQueues);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:AllocationConfiguration.java

示例3: getQueueUserAclInfo

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
@Override
public synchronized List<QueueUserACLInfo> 
getQueueUserAclInfo(UserGroupInformation user) {
  QueueUserACLInfo userAclInfo = 
    recordFactory.newRecordInstance(QueueUserACLInfo.class);
  List<QueueACL> operations = new ArrayList<QueueACL>();
  for (QueueACL operation : QueueACL.values()) {
    if (hasAccess(operation, user)) {
      operations.add(operation);
    }
  }

  userAclInfo.setQueueName(getQueueName());
  userAclInfo.setUserAcls(operations);
  return Collections.singletonList(userAclInfo);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:LeafQueue.java

示例4: testInheritedQueueAcls

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
@Test
public void testInheritedQueueAcls() throws IOException {
  UserGroupInformation user = UserGroupInformation.getCurrentUser();

  LeafQueue a = stubLeafQueue((LeafQueue)queues.get(A));
  LeafQueue b = stubLeafQueue((LeafQueue)queues.get(B));
  ParentQueue c = (ParentQueue)queues.get(C);
  LeafQueue c1 = stubLeafQueue((LeafQueue)queues.get(C1));

  assertFalse(root.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user));
  assertTrue(a.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user));
  assertTrue(b.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user));
  assertFalse(c.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user));
  assertFalse(c1.hasAccess(QueueACL.SUBMIT_APPLICATIONS, user));

  assertTrue(hasQueueACL(
        a.getQueueUserAclInfo(user), QueueACL.SUBMIT_APPLICATIONS));
  assertTrue(hasQueueACL(
        b.getQueueUserAclInfo(user), QueueACL.SUBMIT_APPLICATIONS));
  assertFalse(hasQueueACL(
        c.getQueueUserAclInfo(user), QueueACL.SUBMIT_APPLICATIONS));
  assertFalse(hasQueueACL(
        c1.getQueueUserAclInfo(user), QueueACL.SUBMIT_APPLICATIONS));

}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestLeafQueue.java

示例5: createRMService

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
public ClientRMService createRMService() throws IOException {
  YarnScheduler yarnScheduler = mockYarnScheduler();
  RMContext rmContext = mock(RMContext.class);
  mockRMContext(yarnScheduler, rmContext);
  ConcurrentHashMap<ApplicationId, RMApp> apps = getRMApps(rmContext,
      yarnScheduler);
  when(rmContext.getRMApps()).thenReturn(apps);
  when(rmContext.getYarnConfiguration()).thenReturn(new Configuration());
  RMAppManager appManager = new RMAppManager(rmContext, yarnScheduler, null,
      mock(ApplicationACLsManager.class), new Configuration());
  when(rmContext.getDispatcher().getEventHandler()).thenReturn(
      new EventHandler<Event>() {
        public void handle(Event event) {
        }
      });

  ApplicationACLsManager mockAclsManager = mock(ApplicationACLsManager.class);
  QueueACLsManager mockQueueACLsManager = mock(QueueACLsManager.class);
  when(
      mockQueueACLsManager.checkAccess(any(UserGroupInformation.class),
          any(QueueACL.class), anyString())).thenReturn(true);
  return new ClientRMService(rmContext, yarnScheduler, appManager,
      mockAclsManager, mockQueueACLsManager, null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestClientRMService.java

示例6: fromYarnQueueUserAclsInfo

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
public static QueueAclsInfo[] fromYarnQueueUserAclsInfo(
    List<QueueUserACLInfo> userAcls) {
  List<QueueAclsInfo> acls = new ArrayList<QueueAclsInfo>();
  for (QueueUserACLInfo aclInfo : userAcls) {
    List<String> operations = new ArrayList<String>();
    for (QueueACL qAcl : aclInfo.getUserAcls()) {
      operations.add(qAcl.toString());
    }

    QueueAclsInfo acl =
      new QueueAclsInfo(aclInfo.getQueueName(),
          operations.toArray(new String[operations.size()]));
    acls.add(acl);
  }
  return acls.toArray(new QueueAclsInfo[acls.size()]);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TypeConverter.java

示例7: AllocationConfiguration

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
public AllocationConfiguration(Configuration conf) {
  minQueueResources = new HashMap<String, Resource>();
  maxQueueResources = new HashMap<String, Resource>();
  queueWeights = new HashMap<String, ResourceWeights>();
  queueMaxApps = new HashMap<String, Integer>();
  userMaxApps = new HashMap<String, Integer>();
  queueMaxAMShares = new HashMap<String, Float>();
  userMaxAppsDefault = Integer.MAX_VALUE;
  queueMaxAppsDefault = Integer.MAX_VALUE;
  queueMaxResourcesDefault = Resources.unbounded();
  queueMaxAMShareDefault = 0.5f;
  queueAcls = new HashMap<String, Map<QueueACL, AccessControlList>>();
  minSharePreemptionTimeouts = new HashMap<String, Long>();
  fairSharePreemptionTimeouts = new HashMap<String, Long>();
  fairSharePreemptionThresholds = new HashMap<String, Float>();
  schedulingPolicies = new HashMap<String, SchedulingPolicy>();
  defaultSchedulingPolicy = SchedulingPolicy.DEFAULT_POLICY;
  reservableQueues = new HashSet<>();
  configuredQueues = new HashMap<FSQueueType, Set<String>>();
  for (FSQueueType queueType : FSQueueType.values()) {
    configuredQueues.put(queueType, new HashSet<String>());
  }
  placementPolicy = QueuePlacementPolicy.fromConfiguration(conf,
      configuredQueues);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:AllocationConfiguration.java

示例8: setupQueueConfiguration

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
private void setupQueueConfiguration(CapacitySchedulerConfiguration conf,
    final String newRoot) {

  // Define top-level queues
  conf.setQueues(CapacitySchedulerConfiguration.ROOT,
      new String[] { newRoot });
  conf.setMaximumCapacity(CapacitySchedulerConfiguration.ROOT, 100);
  conf.setAcl(CapacitySchedulerConfiguration.ROOT,
      QueueACL.SUBMIT_APPLICATIONS, " ");

  final String Q_newRoot = CapacitySchedulerConfiguration.ROOT + "."
      + newRoot;
  conf.setQueues(Q_newRoot, new String[] { A });
  conf.setCapacity(Q_newRoot, 100);
  conf.setMaximumCapacity(Q_newRoot, 100);
  conf.setAcl(Q_newRoot, QueueACL.SUBMIT_APPLICATIONS, " ");

  final String Q_A = Q_newRoot + "." + A;
  conf.setCapacity(Q_A, 100f);
  conf.setMaximumCapacity(Q_A, 100);
  conf.setAcl(Q_A, QueueACL.SUBMIT_APPLICATIONS, "*");

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestReservations.java

示例9: setUserAcls

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
@Override
public void setUserAcls(List<QueueACL> userAclsList) {
  if (userAclsList == null) {
    builder.clearUserAcls();
  }
  this.userAclsList = userAclsList;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:QueueUserACLInfoPBImpl.java

示例10: initLocalQueueUserAclsList

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
private void initLocalQueueUserAclsList() {
  if (this.userAclsList != null) {
    return;
  }
  QueueUserACLInfoProtoOrBuilder p = viaProto ? proto : builder;
  List<QueueACLProto> list = p.getUserAclsList();
  userAclsList = new ArrayList<QueueACL>();

  for (QueueACLProto a : list) {
    userAclsList.add(convertFromProtoFormat(a));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:QueueUserACLInfoPBImpl.java

示例11: addQueueACLsToProto

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
private void addQueueACLsToProto() {
  maybeInitBuilder();
  builder.clearUserAcls();
  if (userAclsList == null)
    return;
  Iterable<QueueACLProto> iterable = new Iterable<QueueACLProto>() {
    @Override
    public Iterator<QueueACLProto> iterator() {
      return new Iterator<QueueACLProto>() {

        Iterator<QueueACL> iter = userAclsList.iterator();

        @Override
        public boolean hasNext() {
          return iter.hasNext();
        }

        @Override
        public QueueACLProto next() {
          return convertToProtoFormat(iter.next());
        }

        @Override
        public void remove() {
          throw new UnsupportedOperationException();

        }
      };

    }
  };
  builder.addAllUserAcls(iterable);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:QueueUserACLInfoPBImpl.java

示例12: checkAccess

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
public boolean checkAccess(UserGroupInformation callerUGI,
    QueueACL acl, String queueName) {
  if (!isACLsEnable) {
    return true;
  }
  return scheduler.checkAccess(callerUGI, acl, queueName);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:QueueACLsManager.java

示例13: hasAccess

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
protected Boolean hasAccess(RMApp app, HttpServletRequest hsr) {
  // Check for the authorization.
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  if (callerUGI != null
      && !(this.rm.getApplicationACLsManager().checkAccess(callerUGI,
            ApplicationAccessType.VIEW_APP, app.getUser(),
            app.getApplicationId()) ||
          this.rm.getQueueACLsManager().checkAccess(callerUGI,
            QueueACL.ADMINISTER_QUEUE, app.getQueue()))) {
    return false;
  }
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:RMWebServices.java

示例14: checkAccess

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
/**
 * check if the calling user has the access to application information.
 * @param callerUGI
 * @param owner
 * @param operationPerformed
 * @param application
 * @return
 */
private boolean checkAccess(UserGroupInformation callerUGI, String owner,
    ApplicationAccessType operationPerformed,
    RMApp application) {
  return applicationsACLsManager.checkAccess(callerUGI, operationPerformed,
      owner, application.getApplicationId())
      || queueACLsManager.checkAccess(callerUGI, QueueACL.ADMINISTER_QUEUE,
          application.getQueue());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ClientRMService.java

示例15: getQueueAcls

import org.apache.hadoop.yarn.api.records.QueueACL; //导入依赖的package包/类
public Map<QueueACL, AccessControlList> getQueueAcls() {
  Map<QueueACL, AccessControlList> acls =
    new HashMap<QueueACL, AccessControlList>();
  for (QueueACL acl : QueueACL.values()) {
    acls.put(acl, new AccessControlList("*"));
  }
  return acls;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:FifoScheduler.java


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