• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ResourceInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createNewApplication

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
/**
 * Function that actually creates the ApplicationId by calling the
 * ClientRMService
 * 
 * @return returns structure containing the app-id and maximum resource
 *         capabilities
 */
private NewApplication createNewApplication() {
  GetNewApplicationRequest req =
      recordFactory.newRecordInstance(GetNewApplicationRequest.class);
  GetNewApplicationResponse resp;
  try {
    resp = rm.getClientRMService().getNewApplication(req);
  } catch (YarnException e) {
    String msg = "Unable to create new app from RM web service";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
  NewApplication appId =
      new NewApplication(resp.getApplicationId().toString(),
        new ResourceInfo(resp.getMaximumResourceCapability()));
  return appId;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:RMWebServices.java


示例2: getPercentage

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
private String getPercentage(ResourceInfo numerator, ResourceInfo denominator) {
  StringBuilder percentString = new StringBuilder("Memory: ");
  if (numerator != null) {
    percentString.append(numerator.getMemory());
  }
  if (denominator.getMemory() != 0) {
    percentString.append(" (<span title='of used resources in this queue'>")
      .append(StringUtils.format("%.2f", numerator.getMemory() * 100.0 /
        denominator.getMemory()) + "%</span>)");
  }
  percentString.append(", vCores: ");
  if (numerator != null) {
    percentString.append(numerator.getvCores());
  }
  if (denominator.getvCores() != 0) {
    percentString.append(" (<span title='of used resources in this queue'>")
      .append(StringUtils.format("%.2f", numerator.getvCores() * 100.0 /
      denominator.getvCores()) + "%</span>)");
  }
  return percentString.toString();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:CapacitySchedulerPage.java


示例3: UserInfo

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
UserInfo(String username, Resource resUsed, int activeApps, int pendingApps,
    Resource amResUsed, Resource resourceLimit) {
  this.username = username;
  this.resourcesUsed = new ResourceInfo(resUsed);
  this.numActiveApplications = activeApps;
  this.numPendingApplications = pendingApps;
  this.AMResourceUsed = new ResourceInfo(amResUsed);
  this.userResourceLimit = new ResourceInfo(resourceLimit);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:UserInfo.java


示例4: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  TBODY<TABLE<Hamlet>> tbody =
      html.table("#userinfo").thead().$class("ui-widget-header").tr().th()
          .$class("ui-state-default")._("User Name")._().th()
          .$class("ui-state-default")._("Max Resource")._().th()
          .$class("ui-state-default")._("Used Resource")._().th()
          .$class("ui-state-default")._("Max AM Resource")._().th()
          .$class("ui-state-default")._("Used AM Resource")._().th()
          .$class("ui-state-default")._("Schedulable Apps")._().th()
          .$class("ui-state-default")._("Non-Schedulable Apps")._()._()._()
          .tbody();

  ArrayList<UserInfo> users = lqinfo.getUsers().getUsersList();
  for (UserInfo userInfo : users) {
    ResourceInfo resourcesUsed = userInfo.getResourcesUsed();
    if (nodeLabel != null) {
      resourcesUsed = userInfo.getResourceUsageInfo()
          .getPartitionResourceUsageInfo(nodeLabel).getUsed();
    }
    tbody.tr().td(userInfo.getUsername())
        .td(userInfo.getUserResourceLimit().toString())
        .td(resourcesUsed.toString())
        .td(lqinfo.getUserAMResourceLimit().toString())
        .td(userInfo.getAMResourcesUsed().toString())
        .td(Integer.toString(userInfo.getNumActiveApplications()))
        .td(Integer.toString(userInfo.getNumPendingApplications()))._();
  }

  html.div().$class("usersinfo").h5("Active Users Info")._();
  tbody._()._();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:CapacitySchedulerPage.java


示例5: UserInfo

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
UserInfo(String username, Resource resUsed, int activeApps, int pendingApps,
    Resource amResUsed, Resource resourceLimit, ResourceUsage resourceUsage) {
  this.username = username;
  this.resourcesUsed = new ResourceInfo(resUsed);
  this.numActiveApplications = activeApps;
  this.numPendingApplications = pendingApps;
  this.AMResourceUsed = new ResourceInfo(amResUsed);
  this.userResourceLimit = new ResourceInfo(resourceLimit);
  this.resources = new ResourceUsageInfo(resourceUsage);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:11,代码来源:UserInfo.java


示例6: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  StringBuilder activeUserList = new StringBuilder("");
  ResourceInfo usedResources = lqinfo.getResourcesUsed();
  ArrayList<UserInfo> users = lqinfo.getUsers().getUsersList();
  for (UserInfo entry: users) {
    activeUserList.append(entry.getUsername()).append(" &lt;")
      .append(getPercentage(entry.getResourcesUsed(), usedResources))
      .append(", Schedulable Apps: " + entry.getNumActiveApplications())
      .append(", Non-Schedulable Apps: " + entry.getNumPendingApplications())
      .append("&gt;<br style='display:block'>"); //Force line break
  }

  ResponseInfo ri = info("\'" + lqinfo.getQueuePath().substring(5) + "\' Queue Status").
      _("Queue State:", lqinfo.getQueueState()).
      _("Used Capacity:", percent(lqinfo.getUsedCapacity() / 100)).
      _("Absolute Used Capacity:", percent(lqinfo.getAbsoluteUsedCapacity() / 100)).
      _("Absolute Capacity:", percent(lqinfo.getAbsoluteCapacity() / 100)).
      _("Absolute Max Capacity:", percent(lqinfo.getAbsoluteMaxCapacity() / 100)).
      _("Used Resources:", lqinfo.getResourcesUsed().toString()).
      _("Num Schedulable Applications:", Integer.toString(lqinfo.getNumActiveApplications())).
      _("Num Non-Schedulable Applications:", Integer.toString(lqinfo.getNumPendingApplications())).
      _("Num Containers:", Integer.toString(lqinfo.getNumContainers())).
      _("Max Applications:", Integer.toString(lqinfo.getMaxApplications())).
      _("Max Applications Per User:", Integer.toString(lqinfo.getMaxApplicationsPerUser())).
      _("Max Schedulable Applications:", Integer.toString(lqinfo.getMaxActiveApplications())).
      _("Max Schedulable Applications Per User:", Integer.toString(lqinfo.getMaxActiveApplicationsPerUser())).
      _("Configured Capacity:", percent(lqinfo.getCapacity() / 100)).
      _("Configured Max Capacity:", percent(lqinfo.getMaxCapacity() / 100)).
      _("Configured Minimum User Limit Percent:", Integer.toString(lqinfo.getUserLimit()) + "%").
      _("Configured User Limit Factor:", String.format("%.1f", lqinfo.getUserLimitFactor())).
      _("Active Users: ", activeUserList.toString()).
      _r("Accessible Node Labels:", StringUtils.join(",", lqinfo.getNodeLabels()));

  html._(InfoBlock.class);

  // clear the info contents so this queue's info doesn't accumulate into another queue's info
  ri.clear();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:40,代码来源:CapacitySchedulerPage.java


示例7: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  StringBuilder activeUserList = new StringBuilder("");
  ResourceInfo usedResources = lqinfo.getResourcesUsed();
  ArrayList<UserInfo> users = lqinfo.getUsers().getUsersList();
  for (UserInfo entry: users) {
    activeUserList.append(entry.getUsername()).append(" &lt;")
      .append(getPercentage(entry.getResourcesUsed(), usedResources))
      .append(", Active Apps: " + entry.getNumActiveApplications())
      .append(", Pending Apps: " + entry.getNumPendingApplications())
      .append("&gt;<br style='display:block'>"); //Force line break
  }

  ResponseInfo ri = info("\'" + lqinfo.getQueuePath().substring(5) + "\' Queue Status").
      _("Queue State:", lqinfo.getQueueState()).
      _("Used Capacity:", percent(lqinfo.getUsedCapacity() / 100)).
      _("Absolute Capacity:", percent(lqinfo.getAbsoluteCapacity() / 100)).
      _("Absolute Max Capacity:", percent(lqinfo.getAbsoluteMaxCapacity() / 100)).
      _("Used Resources:", StringEscapeUtils.escapeHtml(lqinfo.getUsedResources().toString())).
      _("Num Active Applications:", Integer.toString(lqinfo.getNumActiveApplications())).
      _("Num Pending Applications:", Integer.toString(lqinfo.getNumPendingApplications())).
      _("Num Containers:", Integer.toString(lqinfo.getNumContainers())).
      _("Max Applications:", Integer.toString(lqinfo.getMaxApplications())).
      _("Max Applications Per User:", Integer.toString(lqinfo.getMaxApplicationsPerUser())).
      _("Max Active Applications:", Integer.toString(lqinfo.getMaxActiveApplications())).
      _("Max Active Applications Per User:", Integer.toString(lqinfo.getMaxActiveApplicationsPerUser())).
      _("Configured Capacity:", percent(lqinfo.getCapacity() / 100)).
      _("Configured Max Capacity:", percent(lqinfo.getMaxCapacity() / 100)).
      _("Configured Minimum User Limit Percent:", Integer.toString(lqinfo.getUserLimit()) + "%").
      _("Configured User Limit Factor:", String.format("%.1f", lqinfo.getUserLimitFactor())).
      _r("Active users: ", activeUserList.toString());

  html._(InfoBlock.class);

  // clear the info contents so this queue's info doesn't accumulate into another queue's info
  ri.clear();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:38,代码来源:CapacitySchedulerPage.java


示例8: renderQueueCapacityInfo

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
private void renderQueueCapacityInfo(ResponseInfo ri, String label) {
  PartitionQueueCapacitiesInfo capacities =
      lqinfo.getCapacities().getPartitionQueueCapacitiesInfo(label);
  PartitionResourcesInfo resourceUsages =
      lqinfo.getResources().getPartitionResourceUsageInfo(label);

  // Get UserInfo from first user to calculate AM Resource Limit per user.
  ResourceInfo userAMResourceLimit = null;
  ArrayList<UserInfo> usersList = lqinfo.getUsers().getUsersList();
  if (usersList.isEmpty()) {
    // If no users are present, consider AM Limit for that queue.
    userAMResourceLimit = resourceUsages.getAMLimit();
  } else {
    userAMResourceLimit = usersList.get(0)
        .getResourceUsageInfo().getPartitionResourceUsageInfo(label)
        .getAMLimit();
  }
  ResourceInfo amUsed = (resourceUsages.getAmUsed() == null)
      ? new ResourceInfo(Resources.none())
      : resourceUsages.getAmUsed();
  ri.
  _("Used Capacity:", percent(capacities.getUsedCapacity() / 100)).
  _("Configured Capacity:", percent(capacities.getCapacity() / 100)).
  _("Configured Max Capacity:", percent(capacities.getMaxCapacity() / 100)).
  _("Absolute Used Capacity:", percent(capacities.getAbsoluteUsedCapacity() / 100)).
  _("Absolute Configured Capacity:", percent(capacities.getAbsoluteCapacity() / 100)).
  _("Absolute Configured Max Capacity:", percent(capacities.getAbsoluteMaxCapacity() / 100)).
  _("Used Resources:", resourceUsages.getUsed().toString()).
  _("Configured Max Application Master Limit:", StringUtils.format("%.1f",
      capacities.getMaxAMLimitPercentage())).
  _("Max Application Master Resources:",
      resourceUsages.getAMLimit().toString()).
  _("Used Application Master Resources:",
      amUsed.toString()).
  _("Max Application Master Resources Per User:",
      userAMResourceLimit.toString());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:38,代码来源:CapacitySchedulerPage.java


示例9: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  TBODY<TABLE<Hamlet>> tbody =
      html.table("#userinfo").thead().$class("ui-widget-header").tr().th()
          .$class("ui-state-default")._("User Name")._().th()
          .$class("ui-state-default")._("Max Resource")._().th()
          .$class("ui-state-default")._("Used Resource")._().th()
          .$class("ui-state-default")._("Max AM Resource")._().th()
          .$class("ui-state-default")._("Used AM Resource")._().th()
          .$class("ui-state-default")._("Schedulable Apps")._().th()
          .$class("ui-state-default")._("Non-Schedulable Apps")._()._()._()
          .tbody();

  ArrayList<UserInfo> users = lqinfo.getUsers().getUsersList();
  for (UserInfo userInfo : users) {
    ResourceInfo resourcesUsed = userInfo.getResourcesUsed();
    PartitionResourcesInfo resourceUsages = lqinfo
        .getResources()
        .getPartitionResourceUsageInfo((nodeLabel == null) ? "" : nodeLabel);
    if (nodeLabel != null) {
      resourcesUsed = userInfo.getResourceUsageInfo()
          .getPartitionResourceUsageInfo(nodeLabel).getUsed();
    }
    ResourceInfo amUsed = (resourceUsages.getAmUsed() == null)
        ? new ResourceInfo(Resources.none())
        : resourceUsages.getAmUsed();
    tbody.tr().td(userInfo.getUsername())
        .td(userInfo.getUserResourceLimit().toString())
        .td(resourcesUsed.toString())
        .td(resourceUsages.getAMLimit().toString())
        .td(amUsed.toString())
        .td(Integer.toString(userInfo.getNumActiveApplications()))
        .td(Integer.toString(userInfo.getNumPendingApplications()))._();
  }

  html.div().$class("usersinfo").h5("Active Users Info")._();
  tbody._()._();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:CapacitySchedulerPage.java


示例10: UserInfo

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
UserInfo(String username, Resource resUsed, int activeApps, int pendingApps,
    Resource amResUsed, Resource resourceLimit, ResourceUsage resourceUsage) {
  this.username = username;
  this.resourcesUsed = new ResourceInfo(resUsed);
  this.numActiveApplications = activeApps;
  this.numPendingApplications = pendingApps;
  this.AMResourceUsed = new ResourceInfo(amResUsed);
  this.userResourceLimit = new ResourceInfo(resourceLimit);
  this.resources = new ResourcesInfo(resourceUsage);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:11,代码来源:UserInfo.java


示例11: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  StringBuilder activeUserList = new StringBuilder("");
  ResourceInfo usedResources = lqinfo.getResourcesUsed();
  ArrayList<UserInfo> users = lqinfo.getUsers().getUsersList();
  for (UserInfo entry: users) {
    activeUserList.append(entry.getUsername()).append(" &lt;")
      .append(getPercentage(entry.getResourcesUsed(), usedResources))
      .append(", Schedulable Apps: " + entry.getNumActiveApplications())
      .append(", Non-Schedulable Apps: " + entry.getNumPendingApplications())
      .append("&gt;<br style='display:block'>"); //Force line break
  }

  ResponseInfo ri = info("\'" + lqinfo.getQueuePath().substring(5) + "\' Queue Status").
      _("Queue State:", lqinfo.getQueueState()).
      _("Used Capacity:", percent(lqinfo.getUsedCapacity() / 100)).
      _("Absolute Used Capacity:", percent(lqinfo.getAbsoluteUsedCapacity() / 100)).
      _("Absolute Capacity:", percent(lqinfo.getAbsoluteCapacity() / 100)).
      _("Absolute Max Capacity:", percent(lqinfo.getAbsoluteMaxCapacity() / 100)).
      _("Used Resources:", StringEscapeUtils.escapeHtml(lqinfo.getUsedResources().toString())).
      _("Num Schedulable Applications:", Integer.toString(lqinfo.getNumActiveApplications())).
      _("Num Non-Schedulable Applications:", Integer.toString(lqinfo.getNumPendingApplications())).
      _("Num Containers:", Integer.toString(lqinfo.getNumContainers())).
      _("Max Applications:", Integer.toString(lqinfo.getMaxApplications())).
      _("Max Applications Per User:", Integer.toString(lqinfo.getMaxApplicationsPerUser())).
      _("Max Schedulable Applications:", Integer.toString(lqinfo.getMaxActiveApplications())).
      _("Max Schedulable Applications Per User:", Integer.toString(lqinfo.getMaxActiveApplicationsPerUser())).
      _("Configured Capacity:", percent(lqinfo.getCapacity() / 100)).
      _("Configured Max Capacity:", percent(lqinfo.getMaxCapacity() / 100)).
      _("Configured Minimum User Limit Percent:", Integer.toString(lqinfo.getUserLimit()) + "%").
      _("Configured User Limit Factor:", String.format("%.1f", lqinfo.getUserLimitFactor())).
      _r("Active users: ", activeUserList.toString());

  html._(InfoBlock.class);

  // clear the info contents so this queue's info doesn't accumulate into another queue's info
  ri.clear();
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:39,代码来源:CapacitySchedulerPage.java


示例12: render

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Override
protected void render(Block html) {
  StringBuilder activeUserList = new StringBuilder("");
  ResourceInfo usedResources = lqinfo.getResourcesUsed();
  ArrayList<UserInfo> users = lqinfo.getUsers().getUsersList();
  for (UserInfo entry: users) {
    activeUserList.append(entry.getUsername()).append(" &lt;")
      .append(getPercentage(entry.getResourcesUsed(), usedResources))
      .append(", Schedulable Apps: " + entry.getNumActiveApplications())
      .append(", Non-Schedulable Apps: " + entry.getNumPendingApplications())
      .append("&gt;<br style='display:block'>"); //Force line break
  }

  ResponseInfo ri = info("\'" + lqinfo.getQueuePath().substring(5) + "\' Queue Status").
      _("Queue State:", lqinfo.getQueueState()).
      _("Used Capacity:", percent(lqinfo.getUsedCapacity() / 100)).
      _("Absolute Used Capacity:", percent(lqinfo.getAbsoluteUsedCapacity() / 100)).
      _("Absolute Capacity:", percent(lqinfo.getAbsoluteCapacity() / 100)).
      _("Absolute Max Capacity:", percent(lqinfo.getAbsoluteMaxCapacity() / 100)).
      _("Used Resources:", StringEscapeUtils.escapeHtml(lqinfo.getResourcesUsed().toString())).
      _("Num Schedulable Applications:", Integer.toString(lqinfo.getNumActiveApplications())).
      _("Num Non-Schedulable Applications:", Integer.toString(lqinfo.getNumPendingApplications())).
      _("Num Containers:", Integer.toString(lqinfo.getNumContainers())).
      _("Max Applications:", Integer.toString(lqinfo.getMaxApplications())).
      _("Max Applications Per User:", Integer.toString(lqinfo.getMaxApplicationsPerUser())).
      _("Max Schedulable Applications:", Integer.toString(lqinfo.getMaxActiveApplications())).
      _("Max Schedulable Applications Per User:", Integer.toString(lqinfo.getMaxActiveApplicationsPerUser())).
      _("Configured Capacity:", percent(lqinfo.getCapacity() / 100)).
      _("Configured Max Capacity:", percent(lqinfo.getMaxCapacity() / 100)).
      _("Configured Minimum User Limit Percent:", Integer.toString(lqinfo.getUserLimit()) + "%").
      _("Configured User Limit Factor:", String.format("%.1f", lqinfo.getUserLimitFactor())).
      _r("Active users: ", activeUserList.toString());

  html._(InfoBlock.class);

  // clear the info contents so this queue's info doesn't accumulate into another queue's info
  ri.clear();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:39,代码来源:CapacitySchedulerPage.java


示例13: getResourcesUsed

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
public ResourceInfo getResourcesUsed() {
  return resourcesUsed;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:UserInfo.java


示例14: getAMResourcesUsed

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
public ResourceInfo getAMResourcesUsed() {
  return AMResourceUsed;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:UserInfo.java


示例15: getUserResourceLimit

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
public ResourceInfo getUserResourceLimit() {
  return userResourceLimit;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:UserInfo.java


示例16: createReservationSubmissionRequest

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
private ReservationSubmissionRequest createReservationSubmissionRequest(
    ReservationSubmissionRequestInfo resContext) {

  // defending against a couple of common submission format problems
  if (resContext == null) {
    throw new BadRequestException(
        "Input ReservationSubmissionContext should not be null");
  }
  ReservationDefinitionInfo resInfo = resContext.getReservationDefinition();
  if (resInfo == null) {
    throw new BadRequestException(
        "Input ReservationDefinition should not be null");
  }

  ReservationRequestsInfo resReqsInfo = resInfo.getReservationRequests();

  if (resReqsInfo == null || resReqsInfo.getReservationRequest() == null
      || resReqsInfo.getReservationRequest().size() == 0) {
    throw new BadRequestException("The ReservationDefinition should"
        + " contain at least one ReservationRequest");
  }

  ReservationRequestInterpreter[] values =
      ReservationRequestInterpreter.values();
  ReservationRequestInterpreter resInt =
      values[resReqsInfo.getReservationRequestsInterpreter()];
  List<ReservationRequest> list = new ArrayList<ReservationRequest>();

  for (ReservationRequestInfo resReqInfo : resReqsInfo
      .getReservationRequest()) {
    ResourceInfo rInfo = resReqInfo.getCapability();
    Resource capability =
        Resource.newInstance(rInfo.getMemory(), rInfo.getvCores());
    int numContainers = resReqInfo.getNumContainers();
    int minConcurrency = resReqInfo.getMinConcurrency();
    long duration = resReqInfo.getDuration();
    ReservationRequest rr =
        ReservationRequest.newInstance(capability, numContainers,
            minConcurrency, duration);
    list.add(rr);
  }
  ReservationRequests reqs = ReservationRequests.newInstance(list, resInt);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(resInfo.getArrival(),
          resInfo.getDeadline(), reqs, resInfo.getReservationName());
  ReservationSubmissionRequest request =
      ReservationSubmissionRequest.newInstance(rDef, resContext.getQueue());

  return request;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:51,代码来源:RMWebServices.java


示例17: createReservationUpdateRequest

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
private ReservationUpdateRequest createReservationUpdateRequest(
    ReservationUpdateRequestInfo resContext) throws IOException {

  // defending against a couple of common submission format problems
  if (resContext == null) {
    throw new BadRequestException(
        "Input ReservationSubmissionContext should not be null");
  }
  ReservationDefinitionInfo resInfo = resContext.getReservationDefinition();
  if (resInfo == null) {
    throw new BadRequestException(
        "Input ReservationDefinition should not be null");
  }
  ReservationRequestsInfo resReqsInfo = resInfo.getReservationRequests();
  if (resReqsInfo == null || resReqsInfo.getReservationRequest() == null
      || resReqsInfo.getReservationRequest().size() == 0) {
    throw new BadRequestException("The ReservationDefinition should"
        + " contain at least one ReservationRequest");
  }
  if (resContext.getReservationId() == null) {
    throw new BadRequestException(
        "Update operations must specify an existing ReservaitonId");
  }

  ReservationRequestInterpreter[] values =
      ReservationRequestInterpreter.values();
  ReservationRequestInterpreter resInt =
      values[resReqsInfo.getReservationRequestsInterpreter()];
  List<ReservationRequest> list = new ArrayList<ReservationRequest>();

  for (ReservationRequestInfo resReqInfo : resReqsInfo
      .getReservationRequest()) {
    ResourceInfo rInfo = resReqInfo.getCapability();
    Resource capability =
        Resource.newInstance(rInfo.getMemory(), rInfo.getvCores());
    int numContainers = resReqInfo.getNumContainers();
    int minConcurrency = resReqInfo.getMinConcurrency();
    long duration = resReqInfo.getDuration();
    ReservationRequest rr =
        ReservationRequest.newInstance(capability, numContainers,
            minConcurrency, duration);
    list.add(rr);
  }
  ReservationRequests reqs = ReservationRequests.newInstance(list, resInt);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(resInfo.getArrival(),
          resInfo.getDeadline(), reqs, resInfo.getReservationName());
  ReservationUpdateRequest request =
      ReservationUpdateRequest.newInstance(rDef, ReservationId
          .parseReservationId(resContext.getReservationId()));

  return request;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:54,代码来源:RMWebServices.java


示例18: testRequestContainerAfterNodePartitionUpdated

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
@Test(timeout = 60000)
public void testRequestContainerAfterNodePartitionUpdated()
    throws Exception {
  // set node -> label
  mgr.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("x", "y",
      "z"));

  // set mapping:
  // h1 -> x
  // h2 -> y
  mgr.addLabelsToNode(ImmutableMap.of(NodeId.newInstance("h1", 0), toSet("x")));
  mgr.addLabelsToNode(ImmutableMap.of(NodeId.newInstance("h2", 0), toSet("y")));

  // inject node label manager
  MockRM rm = new MockRM(getConfigurationWithQueueLabels(conf)) {
    @Override
    public RMNodeLabelsManager createNodeLabelManager() {
      return mgr;
    }
  };
  rm.getRMContext().setNodeLabelManager(mgr);
  rm.start();
  MockNM nm1 = rm.registerNode("h1:1234", 2048);
  MockNM nm2 = rm.registerNode("h2:1234", 2048);
  MockNM nm3 = rm.registerNode("h3:1234", 2048);

  ContainerId containerId;
  // launch an app to queue a1 (label = x), and check all container will
  // be allocated in h1
  RMApp app1 = rm.submitApp(GB, "app", "user", null, "a");
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm, nm3);
  ApplicationResourceUsageReport appResourceUsageReport =
      rm.getResourceScheduler().getAppResourceUsageReport(
          am1.getApplicationAttemptId());
  Assert.assertEquals(1024, appResourceUsageReport.getUsedResources()
      .getMemory());
  Assert.assertEquals(1, appResourceUsageReport.getUsedResources()
      .getVirtualCores());
  // request a container.
  am1.allocate("*", GB, 1, new ArrayList<ContainerId>(), "x");
  containerId = ContainerId.newContainerId(am1.getApplicationAttemptId(), 2);
  rm.waitForState(nm1, containerId, RMContainerState.ALLOCATED, 10 * 1000);
  appResourceUsageReport =
      rm.getResourceScheduler().getAppResourceUsageReport(
          am1.getApplicationAttemptId());
  Assert.assertEquals(2048, appResourceUsageReport.getUsedResources()
      .getMemory());
  Assert.assertEquals(2, appResourceUsageReport.getUsedResources()
      .getVirtualCores());
  LeafQueue queue =
      (LeafQueue) ((CapacityScheduler) rm.getResourceScheduler())
          .getQueue("a");
  ArrayList<UserInfo> users = queue.getUsers();
  for (UserInfo userInfo : users) {
    if (userInfo.getUsername().equals("user")) {
      ResourceInfo resourcesUsed = userInfo.getResourcesUsed();
      Assert.assertEquals(2048, resourcesUsed.getMemory());
      Assert.assertEquals(2, resourcesUsed.getvCores());
    }
  }
  rm.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:63,代码来源:TestCapacitySchedulerNodeLabelUpdate.java


示例19: UserInfo

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
UserInfo(String username, Resource resUsed, int activeApps, int pendingApps) {
  this.username = username;
  this.resourcesUsed = new ResourceInfo(resUsed);
  this.numActiveApplications = activeApps;
  this.numPendingApplications = pendingApps;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:7,代码来源:UserInfo.java


示例20: createReservationSubmissionRequest

import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo; //导入依赖的package包/类
private ReservationSubmissionRequest createReservationSubmissionRequest(
    ReservationSubmissionRequestInfo resContext) throws IOException {

  // defending against a couple of common submission format problems
  if (resContext == null) {
    throw new BadRequestException(
        "Input ReservationSubmissionContext should not be null");
  }
  ReservationDefinitionInfo resInfo = resContext.getReservationDefinition();
  if (resInfo == null) {
    throw new BadRequestException(
        "Input ReservationDefinition should not be null");
  }

  ReservationRequestsInfo resReqsInfo = resInfo.getReservationRequests();

  if (resReqsInfo == null || resReqsInfo.getReservationRequest() == null
      || resReqsInfo.getReservationRequest().size() == 0) {
    throw new BadRequestException("The ReservationDefinition should"
        + " contain at least one ReservationRequest");
  }

  ReservationRequestInterpreter[] values =
      ReservationRequestInterpreter.values();
  ReservationRequestInterpreter resInt =
      values[resReqsInfo.getReservationRequestsInterpreter()];
  List<ReservationRequest> list = new ArrayList<ReservationRequest>();

  for (ReservationRequestInfo resReqInfo : resReqsInfo
      .getReservationRequest()) {
    ResourceInfo rInfo = resReqInfo.getCapability();
    Resource capability =
        Resource.newInstance(rInfo.getMemorySize(), rInfo.getvCores());
    int numContainers = resReqInfo.getNumContainers();
    int minConcurrency = resReqInfo.getMinConcurrency();
    long duration = resReqInfo.getDuration();
    ReservationRequest rr =
        ReservationRequest.newInstance(capability, numContainers,
            minConcurrency, duration);
    list.add(rr);
  }
  ReservationRequests reqs = ReservationRequests.newInstance(list, resInt);
  ReservationDefinition rDef =
      ReservationDefinition.newInstance(resInfo.getArrival(),
          resInfo.getDeadline(), reqs, resInfo.getReservationName());

  ReservationId reservationId = ReservationId.parseReservationId(resContext
      .getReservationId());
  ReservationSubmissionRequest request =
      ReservationSubmissionRequest.newInstance(rDef, resContext.getQueue(),
        reservationId);

  return request;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:55,代码来源:RMWebServices.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RpcProgramMountd类代码示例发布时间:2022-05-22
下一篇:
Java JimpleBody类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap