org.apache.hadoop.yarn.api.records.QueueUserACLInfo Java Examples

The following examples show how to use org.apache.hadoop.yarn.api.records.QueueUserACLInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LeafQueue.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: TypeConverter.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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()]);
}
 
Example #3
Source File: TypeConverter.java    From big-c with Apache License 2.0 6 votes vote down vote up
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()]);
}
 
Example #4
Source File: LeafQueue.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #5
Source File: ProtocolHATestBase.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public List<QueueUserACLInfo> createFakeQueueUserACLInfoList() {
  List<QueueACL> queueACL = new ArrayList<QueueACL>();
  queueACL.add(QueueACL.SUBMIT_APPLICATIONS);
  QueueUserACLInfo info = QueueUserACLInfo.newInstance("root", queueACL);
  List<QueueUserACLInfo> infos = new ArrayList<QueueUserACLInfo>();
  infos.add(info);
  return infos;
}
 
Example #6
Source File: TestParentQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
public boolean hasQueueACL(List<QueueUserACLInfo> aclInfos, QueueACL acl, String qName) {
  for (QueueUserACLInfo aclInfo : aclInfos) {
    if (aclInfo.getQueueName().equals(qName)) {
      if (aclInfo.getUserAcls().contains(acl)) {
        return true;
      }
    }
  }    
  return false;
}
 
Example #7
Source File: TestLeafQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
public boolean hasQueueACL(List<QueueUserACLInfo> aclInfos, QueueACL acl) {
  for (QueueUserACLInfo aclInfo : aclInfos) {
    if (aclInfo.getUserAcls().contains(acl)) {
      return true;
    }
  }    
  return false;
}
 
Example #8
Source File: YarnClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueUserACLInfo> getQueueAclsInfo() throws YarnException,
    IOException {
  GetQueueUserAclsInfoRequest request =
      Records.newRecord(GetQueueUserAclsInfoRequest.class);
  return rmClient.getQueueUserAcls(request).getUserAclsInfoList();
}
 
Example #9
Source File: TestApplicationClientProtocolOnHA.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 15000)
public void testGetQueueUserAclsOnHA() throws Exception {
  List<QueueUserACLInfo> queueUserAclsList = client.getQueueAclsInfo();
  Assert.assertTrue(queueUserAclsList != null
      && !queueUserAclsList.isEmpty());
  Assert.assertEquals(cluster.createFakeQueueUserACLInfoList(),
      queueUserAclsList);
}
 
Example #10
Source File: GetQueueUserAclsInfoResponse.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Private
@Unstable
public static GetQueueUserAclsInfoResponse newInstance(
    List<QueueUserACLInfo> queueUserAclsList) {
  GetQueueUserAclsInfoResponse response =
      Records.newRecord(GetQueueUserAclsInfoResponse.class);
  response.setUserAclsInfoList(queueUserAclsList);
  return response;
}
 
Example #11
Source File: GetQueueUserAclsInfoResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void setUserAclsInfoList(List<QueueUserACLInfo> queueUserAclsList) {
  if (queueUserAclsList == null) {
    builder.clearQueueUserAcls();
  }
  this.queueUserAclsInfoList = queueUserAclsList;
}
 
Example #12
Source File: FSLeafQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public 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);
}
 
Example #13
Source File: TestApplicationClientProtocolOnHA.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 15000)
public void testGetQueueUserAclsOnHA() throws Exception {
  List<QueueUserACLInfo> queueUserAclsList = client.getQueueAclsInfo();
  Assert.assertTrue(queueUserAclsList != null
      && !queueUserAclsList.isEmpty());
  Assert.assertEquals(cluster.createFakeQueueUserACLInfoList(),
      queueUserAclsList);
}
 
Example #14
Source File: FSParentQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized List<QueueUserACLInfo> getQueueUserAclInfo(
    UserGroupInformation user) {
  List<QueueUserACLInfo> userAcls = new ArrayList<QueueUserACLInfo>();
  
  // Add queue acls
  userAcls.add(getUserAclInfo(user));
  
  // Add children queue acls
  for (FSQueue child : childQueues) {
    userAcls.addAll(child.getQueueUserAclInfo(user));
  }
 
  return userAcls;
}
 
Example #15
Source File: FSParentQueue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private synchronized QueueUserACLInfo getUserAclInfo(
    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 userAclInfo;
}
 
Example #16
Source File: FairScheduler.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueUserACLInfo> getQueueUserAclInfo() {
  UserGroupInformation user;
  try {
    user = UserGroupInformation.getCurrentUser();
  } catch (IOException ioe) {
    return new ArrayList<QueueUserACLInfo>();
  }

  return queueMgr.getRootQueue().getQueueUserAclInfo(user);
}
 
Example #17
Source File: GetQueueUserAclsInfoResponsePBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void addLocalQueueUserACLInfosToProto() {
  maybeInitBuilder();
  builder.clearQueueUserAcls();
  if (queueUserAclsInfoList == null)
    return;
  Iterable<QueueUserACLInfoProto> iterable = new Iterable<QueueUserACLInfoProto>() {
    @Override
    public Iterator<QueueUserACLInfoProto> iterator() {
      return new Iterator<QueueUserACLInfoProto>() {

        Iterator<QueueUserACLInfo> iter = queueUserAclsInfoList.iterator();

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

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

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

        }
      };

    }
  };
  builder.addAllQueueUserAcls(iterable);
}
 
Example #18
Source File: YarnClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueUserACLInfo> getQueueAclsInfo() throws YarnException,
    IOException {
  GetQueueUserAclsInfoRequest request =
      Records.newRecord(GetQueueUserAclsInfoRequest.class);
  return rmClient.getQueueUserAcls(request).getUserAclsInfoList();
}
 
Example #19
Source File: GetQueueUserAclsInfoResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void initLocalQueueUserAclsList() {
  if (this.queueUserAclsInfoList != null) {
    return;
  }
  GetQueueUserAclsInfoResponseProtoOrBuilder p = viaProto ? proto : builder;
  List<QueueUserACLInfoProto> list = p.getQueueUserAclsList();
  queueUserAclsInfoList = new ArrayList<QueueUserACLInfo>();

  for (QueueUserACLInfoProto a : list) {
    queueUserAclsInfoList.add(convertFromProtoFormat(a));
  }
}
 
Example #20
Source File: GetQueueUserAclsInfoResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void addLocalQueueUserACLInfosToProto() {
  maybeInitBuilder();
  builder.clearQueueUserAcls();
  if (queueUserAclsInfoList == null)
    return;
  Iterable<QueueUserACLInfoProto> iterable = new Iterable<QueueUserACLInfoProto>() {
    @Override
    public Iterator<QueueUserACLInfoProto> iterator() {
      return new Iterator<QueueUserACLInfoProto>() {

        Iterator<QueueUserACLInfo> iter = queueUserAclsInfoList.iterator();

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

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

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

        }
      };

    }
  };
  builder.addAllQueueUserAcls(iterable);
}
 
Example #21
Source File: TestCapacityScheduler.java    From big-c with Apache License 2.0 5 votes vote down vote up
private int getQueueCount(List<QueueUserACLInfo> queueInformation, String queueName) {
  int result = 0;
  for (QueueUserACLInfo queueUserACLInfo : queueInformation) {
    if (queueName.equals(queueUserACLInfo.getQueueName())) {
      result++;
    }
  }
  return result;
}
 
Example #22
Source File: FifoScheduler.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueUserACLInfo> getQueueUserAclInfo(
    UserGroupInformation unused) {
  QueueUserACLInfo queueUserAclInfo = 
    recordFactory.newRecordInstance(QueueUserACLInfo.class);
  queueUserAclInfo.setQueueName(DEFAULT_QUEUE_NAME);
  queueUserAclInfo.setUserAcls(Arrays.asList(QueueACL.values()));
  return Collections.singletonList(queueUserAclInfo);
}
 
Example #23
Source File: TestCapacityScheduler.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testCapacitySchedulerInfo() throws Exception {
  QueueInfo queueInfo = resourceManager.getResourceScheduler().getQueueInfo("a", true, true);
  Assert.assertEquals(queueInfo.getQueueName(), "a");
  Assert.assertEquals(queueInfo.getChildQueues().size(), 2);

  List<QueueUserACLInfo> userACLInfo = resourceManager.getResourceScheduler().getQueueUserAclInfo();
  Assert.assertNotNull(userACLInfo);
  for (QueueUserACLInfo queueUserACLInfo : userACLInfo) {
    Assert.assertEquals(getQueueCount(userACLInfo, queueUserACLInfo.getQueueName()), 1);
  }

}
 
Example #24
Source File: FSLeafQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public 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);
}
 
Example #25
Source File: FairScheduler.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueUserACLInfo> getQueueUserAclInfo() {
  UserGroupInformation user;
  try {
    user = UserGroupInformation.getCurrentUser();
  } catch (IOException ioe) {
    return new ArrayList<QueueUserACLInfo>();
  }

  return queueMgr.getRootQueue().getQueueUserAclInfo(user);
}
 
Example #26
Source File: FSParentQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
private synchronized QueueUserACLInfo getUserAclInfo(
    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 userAclInfo;
}
 
Example #27
Source File: FSParentQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized List<QueueUserACLInfo> getQueueUserAclInfo(
    UserGroupInformation user) {
  List<QueueUserACLInfo> userAcls = new ArrayList<QueueUserACLInfo>();
  
  // Add queue acls
  userAcls.add(getUserAclInfo(user));
  
  // Add children queue acls
  for (FSQueue child : childQueues) {
    userAcls.addAll(child.getQueueUserAclInfo(user));
  }
 
  return userAcls;
}
 
Example #28
Source File: CapacityScheduler.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
@Lock(Lock.NoLock.class)
public List<QueueUserACLInfo> getQueueUserAclInfo() {
  UserGroupInformation user = null;
  try {
    user = UserGroupInformation.getCurrentUser();
  } catch (IOException ioe) {
    // should never happen
    return new ArrayList<QueueUserACLInfo>();
  }

  return root.getQueueUserAclInfo(user);
}
 
Example #29
Source File: ParentQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
private synchronized QueueUserACLInfo getUserAclInfo(
    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 userAclInfo;
}
 
Example #30
Source File: ParentQueue.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized List<QueueUserACLInfo> getQueueUserAclInfo(
    UserGroupInformation user) {
  List<QueueUserACLInfo> userAcls = new ArrayList<QueueUserACLInfo>();
  
  // Add parent queue acls
  userAcls.add(getUserAclInfo(user));
  
  // Add children queue acls
  for (CSQueue child : childQueues) {
    userAcls.addAll(child.getQueueUserAclInfo(user));
  }
 
  return userAcls;
}