Package com.alibaba.jstorm.container.cgroup

Examples of com.alibaba.jstorm.container.cgroup.CgroupCommon


    this.prepareSubSystem();
  }

  public String startNewWorker(int cpuNum, String workerId)
      throws SecurityException, IOException {
    CgroupCommon workerGroup = new CgroupCommon(workerId, h,
        this.rootCgroup);
    this.center.create(workerGroup);
    CgroupCore cpu = workerGroup.getCores().get(SubSystemType.cpu);
    CpuCore cpuCore = (CpuCore) cpu;
    cpuCore.setCpuShares(cpuNum * ONE_CPU_SLOT);
    StringBuilder sb = new StringBuilder();
    sb.append("cgexec -g cpu:").append(workerGroup.getName()).append(" ");
    return sb.toString();
  }
View Full Code Here


    sb.append("cgexec -g cpu:").append(workerGroup.getName()).append(" ");
    return sb.toString();
  }

  public void shutDownWorker(String workerId, boolean isKilled) {
    CgroupCommon workerGroup = new CgroupCommon(workerId, h,
        this.rootCgroup);
    try {
      if (isKilled == false) {
        for (Integer pid : workerGroup.getTasks()) {
          JStormUtils.kill(pid);
        }
        JStormUtils.sleepMs(1500);
      }
      center.delete(workerGroup);
View Full Code Here

      if (h == null) {
        Set<SubSystemType> types = new HashSet<SubSystemType>();
        types.add(SubSystemType.cpu);
      h = new Hierarchy(JSTORM_HIERARCHY_NAME, types,JSTORM_CPU_HIERARCHY_DIR);
      }
    rootCgroup = new CgroupCommon(root_dir, h, h.getRootCgroups());
  }
View Full Code Here

    // TODO Auto-generated method stub
    if (cgroup.isRoot()) {
      LOG.error("You can't create rootCgroup in this function");
      return;
    }
    CgroupCommon parent = cgroup.getParent();
    while (parent != null) {
      if (!CgroupUtils.dirExists(parent.getDir())) {
        LOG.error(parent.getDir() + "is not existed");
        return;
      }
      parent = parent.getParent();
    }
    Hierarchy h = cgroup.getHierarchy();
    if (mounted(h) == null) {
      LOG.error(h.getDir() + " is not mounted");
      return;
View Full Code Here

  public Hierarchy(String name, Set<SubSystemType> subSystems, String dir) {
    this.name = name;
    this.subSystems = subSystems;
    this.dir = dir;
    this.rootCgroups = new CgroupCommon(this, dir);
    this.type = CgroupUtils.reAnalyse(subSystems);
  }
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.container.cgroup.CgroupCommon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.