Java 类org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes 实例源码

项目:tez    文件:DagAwareYarnTaskScheduler.java   
@Override
public void start() throws Exception {
  super.start();
  client.start();
  if (shouldReuseContainers) {
    reuseExecutor = createExecutor();
  }
  TaskSchedulerContext ctx = getContext();
  RegisterApplicationMasterResponse response = client.registerApplicationMaster(
      ctx.getAppHostName(), ctx.getAppClientPort(), ctx.getAppTrackingUrl());
  ctx.setApplicationRegistrationData(response.getMaximumResourceCapability(),
      response.getApplicationACLs(), response.getClientToAMTokenMasterKey(),
      response.getQueue());
  if (response.getSchedulerResourceTypes().contains(SchedulerResourceTypes.CPU)) {
    resourceCalculator = new MemCpuResourceCalculator();
  } else {
    resourceCalculator = new MemResourceCalculator();
  }
}
项目:hadoop    文件:RegisterApplicationMasterResponsePBImpl.java   
private void initSchedulerResourceTypes() {
  if (this.schedulerResourceTypes != null) {
    return;
  }
  RegisterApplicationMasterResponseProtoOrBuilder p =
      viaProto ? proto : builder;

  List<SchedulerResourceTypes> list = p.getSchedulerResourceTypesList();
  if (list.isEmpty()) {
    this.schedulerResourceTypes =
        EnumSet.noneOf(SchedulerResourceTypes.class);
  } else {
    this.schedulerResourceTypes = EnumSet.copyOf(list);
  }
}
项目:hadoop    文件:RegisterApplicationMasterResponsePBImpl.java   
private void addSchedulerResourceTypes() {
  maybeInitBuilder();
  builder.clearSchedulerResourceTypes();
  if (schedulerResourceTypes == null) {
    return;
  }
  Iterable<? extends SchedulerResourceTypes> values =
      new Iterable<SchedulerResourceTypes>() {

        @Override
        public Iterator<SchedulerResourceTypes> iterator() {
          return new Iterator<SchedulerResourceTypes>() {
            Iterator<SchedulerResourceTypes> settingsIterator =
                schedulerResourceTypes.iterator();

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

            @Override
            public SchedulerResourceTypes next() {
              return settingsIterator.next();
            }

            @Override
            public void remove() {
              throw new UnsupportedOperationException();
            }
          };
        }
      };
  this.builder.addAllSchedulerResourceTypes(values);
}
项目:hadoop    文件:RegisterApplicationMasterResponsePBImpl.java   
@Override
public void setSchedulerResourceTypes(EnumSet<SchedulerResourceTypes> types) {
  if (types == null) {
    return;
  }
  initSchedulerResourceTypes();
  this.schedulerResourceTypes.clear();
  this.schedulerResourceTypes.addAll(types);
}
项目:hadoop    文件:CapacityScheduler.java   
/** {@inheritDoc} */
@Override
public EnumSet<SchedulerResourceTypes> getSchedulingResourceTypes() {
  if (calculator.getClass().getName()
    .equals(DefaultResourceCalculator.class.getName())) {
    return EnumSet.of(SchedulerResourceTypes.MEMORY);
  }
  return EnumSet
    .of(SchedulerResourceTypes.MEMORY, SchedulerResourceTypes.CPU, SchedulerResourceTypes.GPU);
}
项目:hadoop    文件:ResourceCalculatorUtils.java   
public static int computeAvailableContainers(Resource available,
    Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    if (required.getGpuCores() == 0) {
      return Math.min(available.getMemory() / required.getMemory(),
              available.getVirtualCores() / required.getVirtualCores());
    }
    else {
      return Math.min(available.getMemory() / required.getMemory(),
              Math.min(available.getVirtualCores() / required.getVirtualCores(),
                      available.getGpuCores() / required.getGpuCores()));
    }
  }
  return available.getMemory() / required.getMemory();
}
项目:hadoop    文件:ResourceCalculatorUtils.java   
public static int divideAndCeilContainers(Resource required, Resource factor,
    EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    if (factor.getGpuCores() == 0) {
      return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
              divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
    }
    else {
      return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
              Math.max(divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()),
                      divideAndCeil(required.getGpuCores(), factor.getGpuCores())));
    }
  }
  return divideAndCeil(required.getMemory(), factor.getMemory());
}
项目:hadoop    文件:RMCommunicator.java   
public RMCommunicator(ClientService clientService, AppContext context) {
  super("RMCommunicator");
  this.clientService = clientService;
  this.context = context;
  this.eventHandler = context.getEventHandler();
  this.applicationId = context.getApplicationID();
  this.stopped = new AtomicBoolean(false);
  this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
  this.schedulerResourceTypes = EnumSet.of(SchedulerResourceTypes.MEMORY);
}
项目:aliyun-oss-hadoop-fs    文件:RegisterApplicationMasterResponsePBImpl.java   
private void initSchedulerResourceTypes() {
  if (this.schedulerResourceTypes != null) {
    return;
  }
  RegisterApplicationMasterResponseProtoOrBuilder p =
      viaProto ? proto : builder;

  List<SchedulerResourceTypes> list = p.getSchedulerResourceTypesList();
  if (list.isEmpty()) {
    this.schedulerResourceTypes =
        EnumSet.noneOf(SchedulerResourceTypes.class);
  } else {
    this.schedulerResourceTypes = EnumSet.copyOf(list);
  }
}
项目:aliyun-oss-hadoop-fs    文件:RegisterApplicationMasterResponsePBImpl.java   
private void addSchedulerResourceTypes() {
  maybeInitBuilder();
  builder.clearSchedulerResourceTypes();
  if (schedulerResourceTypes == null) {
    return;
  }
  Iterable<? extends SchedulerResourceTypes> values =
      new Iterable<SchedulerResourceTypes>() {

        @Override
        public Iterator<SchedulerResourceTypes> iterator() {
          return new Iterator<SchedulerResourceTypes>() {
            Iterator<SchedulerResourceTypes> settingsIterator =
                schedulerResourceTypes.iterator();

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

            @Override
            public SchedulerResourceTypes next() {
              return settingsIterator.next();
            }

            @Override
            public void remove() {
              throw new UnsupportedOperationException();
            }
          };
        }
      };
  this.builder.addAllSchedulerResourceTypes(values);
}
项目:aliyun-oss-hadoop-fs    文件:RegisterApplicationMasterResponsePBImpl.java   
@Override
public void setSchedulerResourceTypes(EnumSet<SchedulerResourceTypes> types) {
  if (types == null) {
    return;
  }
  initSchedulerResourceTypes();
  this.schedulerResourceTypes.clear();
  this.schedulerResourceTypes.addAll(types);
}
项目:aliyun-oss-hadoop-fs    文件:CapacityScheduler.java   
/** {@inheritDoc} */
@Override
public EnumSet<SchedulerResourceTypes> getSchedulingResourceTypes() {
  if (calculator.getClass().getName()
    .equals(DefaultResourceCalculator.class.getName())) {
    return EnumSet.of(SchedulerResourceTypes.MEMORY);
  }
  return EnumSet.of(SchedulerResourceTypes.MEMORY, SchedulerResourceTypes.CPU);
}
项目:aliyun-oss-hadoop-fs    文件:ResourceCalculatorUtils.java   
public static int computeAvailableContainers(Resource available,
    Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.min(
      calculateRatioOrMaxValue(available.getMemory(), required.getMemory()),
      calculateRatioOrMaxValue(available.getVirtualCores(), required
          .getVirtualCores()));
  }
  return calculateRatioOrMaxValue(
    available.getMemory(), required.getMemory());
}
项目:aliyun-oss-hadoop-fs    文件:ResourceCalculatorUtils.java   
public static int divideAndCeilContainers(Resource required, Resource factor,
    EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
      divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
  }
  return divideAndCeil(required.getMemory(), factor.getMemory());
}
项目:aliyun-oss-hadoop-fs    文件:RMCommunicator.java   
public RMCommunicator(ClientService clientService, AppContext context) {
  super("RMCommunicator");
  this.clientService = clientService;
  this.context = context;
  this.eventHandler = context.getEventHandler();
  this.applicationId = context.getApplicationID();
  this.stopped = new AtomicBoolean(false);
  this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
  this.schedulerResourceTypes = EnumSet.of(SchedulerResourceTypes.MEMORY);
}
项目:big-c    文件:RegisterApplicationMasterResponsePBImpl.java   
private void initSchedulerResourceTypes() {
  if (this.schedulerResourceTypes != null) {
    return;
  }
  RegisterApplicationMasterResponseProtoOrBuilder p =
      viaProto ? proto : builder;

  List<SchedulerResourceTypes> list = p.getSchedulerResourceTypesList();
  if (list.isEmpty()) {
    this.schedulerResourceTypes =
        EnumSet.noneOf(SchedulerResourceTypes.class);
  } else {
    this.schedulerResourceTypes = EnumSet.copyOf(list);
  }
}
项目:big-c    文件:RegisterApplicationMasterResponsePBImpl.java   
private void addSchedulerResourceTypes() {
  maybeInitBuilder();
  builder.clearSchedulerResourceTypes();
  if (schedulerResourceTypes == null) {
    return;
  }
  Iterable<? extends SchedulerResourceTypes> values =
      new Iterable<SchedulerResourceTypes>() {

        @Override
        public Iterator<SchedulerResourceTypes> iterator() {
          return new Iterator<SchedulerResourceTypes>() {
            Iterator<SchedulerResourceTypes> settingsIterator =
                schedulerResourceTypes.iterator();

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

            @Override
            public SchedulerResourceTypes next() {
              return settingsIterator.next();
            }

            @Override
            public void remove() {
              throw new UnsupportedOperationException();
            }
          };
        }
      };
  this.builder.addAllSchedulerResourceTypes(values);
}
项目:big-c    文件:RegisterApplicationMasterResponsePBImpl.java   
@Override
public void setSchedulerResourceTypes(EnumSet<SchedulerResourceTypes> types) {
  if (types == null) {
    return;
  }
  initSchedulerResourceTypes();
  this.schedulerResourceTypes.clear();
  this.schedulerResourceTypes.addAll(types);
}
项目:big-c    文件:CapacityScheduler.java   
/** {@inheritDoc} */
@Override
public EnumSet<SchedulerResourceTypes> getSchedulingResourceTypes() {
  if (calculator.getClass().getName()
    .equals(DefaultResourceCalculator.class.getName())) {
    return EnumSet.of(SchedulerResourceTypes.MEMORY);
  }
  return EnumSet
    .of(SchedulerResourceTypes.MEMORY, SchedulerResourceTypes.CPU);
}
项目:big-c    文件:ResourceCalculatorUtils.java   
public static int computeAvailableContainers(Resource available,
    Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.min(available.getMemory() / required.getMemory(),
      available.getVirtualCores() / required.getVirtualCores());
  }
  return available.getMemory() / required.getMemory();
}
项目:big-c    文件:ResourceCalculatorUtils.java   
public static int divideAndCeilContainers(Resource required, Resource factor,
    EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
      divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
  }
  return divideAndCeil(required.getMemory(), factor.getMemory());
}
项目:big-c    文件:RMCommunicator.java   
public RMCommunicator(ClientService clientService, AppContext context) {
  super("RMCommunicator");
  this.clientService = clientService;
  this.context = context;
  this.eventHandler = context.getEventHandler();
  this.applicationId = context.getApplicationID();
  this.stopped = new AtomicBoolean(false);
  this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
  this.schedulerResourceTypes = EnumSet.of(SchedulerResourceTypes.MEMORY);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:RegisterApplicationMasterResponsePBImpl.java   
private void initSchedulerResourceTypes() {
  if (this.schedulerResourceTypes != null) {
    return;
  }
  RegisterApplicationMasterResponseProtoOrBuilder p =
      viaProto ? proto : builder;

  List<SchedulerResourceTypes> list = p.getSchedulerResourceTypesList();
  if (list.isEmpty()) {
    this.schedulerResourceTypes =
        EnumSet.noneOf(SchedulerResourceTypes.class);
  } else {
    this.schedulerResourceTypes = EnumSet.copyOf(list);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:RegisterApplicationMasterResponsePBImpl.java   
private void addSchedulerResourceTypes() {
  maybeInitBuilder();
  builder.clearSchedulerResourceTypes();
  if (schedulerResourceTypes == null) {
    return;
  }
  Iterable<? extends SchedulerResourceTypes> values =
      new Iterable<SchedulerResourceTypes>() {

        @Override
        public Iterator<SchedulerResourceTypes> iterator() {
          return new Iterator<SchedulerResourceTypes>() {
            Iterator<SchedulerResourceTypes> settingsIterator =
                schedulerResourceTypes.iterator();

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

            @Override
            public SchedulerResourceTypes next() {
              return settingsIterator.next();
            }

            @Override
            public void remove() {
              throw new UnsupportedOperationException();
            }
          };
        }
      };
  this.builder.addAllSchedulerResourceTypes(values);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:RegisterApplicationMasterResponsePBImpl.java   
@Override
public void setSchedulerResourceTypes(EnumSet<SchedulerResourceTypes> types) {
  if (types == null) {
    return;
  }
  initSchedulerResourceTypes();
  this.schedulerResourceTypes.clear();
  this.schedulerResourceTypes.addAll(types);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:CapacityScheduler.java   
/** {@inheritDoc} */
@Override
public EnumSet<SchedulerResourceTypes> getSchedulingResourceTypes() {
  if (calculator.getClass().getName()
    .equals(DefaultResourceCalculator.class.getName())) {
    return EnumSet.of(SchedulerResourceTypes.MEMORY);
  }
  return EnumSet
    .of(SchedulerResourceTypes.MEMORY, SchedulerResourceTypes.CPU);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ResourceCalculatorUtils.java   
public static int computeAvailableContainers(Resource available,
    Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.min(available.getMemory() / required.getMemory(),
      available.getVirtualCores() / required.getVirtualCores());
  }
  return available.getMemory() / required.getMemory();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ResourceCalculatorUtils.java   
public static int divideAndCeilContainers(Resource required, Resource factor,
    EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
      divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
  }
  return divideAndCeil(required.getMemory(), factor.getMemory());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:RMCommunicator.java   
public RMCommunicator(ClientService clientService, AppContext context) {
  super("RMCommunicator");
  this.clientService = clientService;
  this.context = context;
  this.eventHandler = context.getEventHandler();
  this.applicationId = context.getApplicationID();
  this.stopped = new AtomicBoolean(false);
  this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
  this.schedulerResourceTypes = EnumSet.of(SchedulerResourceTypes.MEMORY);
}
项目:FlexMap    文件:ResourceCalculatorUtils.java   
public static int computeAvailableContainers(Resource available,
    Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.min(available.getMemory() / required.getMemory(),
      available.getVirtualCores() / required.getVirtualCores());
  }
  return available.getMemory() / required.getMemory();
}
项目:FlexMap    文件:ResourceCalculatorUtils.java   
public static int divideAndCeilContainers(Resource required, Resource factor,
    EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
      divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
  }
  return divideAndCeil(required.getMemory(), factor.getMemory());
}
项目:FlexMap    文件:RMCommunicator.java   
public RMCommunicator(ClientService clientService, AppContext context) {
  super("RMCommunicator");
  this.clientService = clientService;
  this.context = context;
  this.eventHandler = context.getEventHandler();
  this.applicationId = context.getApplicationID();
  this.stopped = new AtomicBoolean(false);
  this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
  this.schedulerResourceTypes = EnumSet.of(SchedulerResourceTypes.MEMORY);
}
项目:hops    文件:RegisterApplicationMasterResponsePBImpl.java   
private void initSchedulerResourceTypes() {
  if (this.schedulerResourceTypes != null) {
    return;
  }
  RegisterApplicationMasterResponseProtoOrBuilder p =
      viaProto ? proto : builder;

  List<SchedulerResourceTypes> list = p.getSchedulerResourceTypesList();
  if (list.isEmpty()) {
    this.schedulerResourceTypes =
        EnumSet.noneOf(SchedulerResourceTypes.class);
  } else {
    this.schedulerResourceTypes = EnumSet.copyOf(list);
  }
}
项目:hops    文件:RegisterApplicationMasterResponsePBImpl.java   
private void addSchedulerResourceTypes() {
  maybeInitBuilder();
  builder.clearSchedulerResourceTypes();
  if (schedulerResourceTypes == null) {
    return;
  }
  Iterable<? extends SchedulerResourceTypes> values =
      new Iterable<SchedulerResourceTypes>() {

        @Override
        public Iterator<SchedulerResourceTypes> iterator() {
          return new Iterator<SchedulerResourceTypes>() {
            Iterator<SchedulerResourceTypes> settingsIterator =
                schedulerResourceTypes.iterator();

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

            @Override
            public SchedulerResourceTypes next() {
              return settingsIterator.next();
            }

            @Override
            public void remove() {
              throw new UnsupportedOperationException();
            }
          };
        }
      };
  this.builder.addAllSchedulerResourceTypes(values);
}
项目:hops    文件:RegisterApplicationMasterResponsePBImpl.java   
@Override
public void setSchedulerResourceTypes(EnumSet<SchedulerResourceTypes> types) {
  if (types == null) {
    return;
  }
  initSchedulerResourceTypes();
  this.schedulerResourceTypes.clear();
  this.schedulerResourceTypes.addAll(types);
}
项目:hops    文件:CapacityScheduler.java   
/** {@inheritDoc} */
@Override
public EnumSet<SchedulerResourceTypes> getSchedulingResourceTypes() {
  if (calculator.getClass().getName()
    .equals(DefaultResourceCalculator.class.getName())) {
    return EnumSet.of(SchedulerResourceTypes.MEMORY);
  }
  return EnumSet.of(SchedulerResourceTypes.MEMORY, SchedulerResourceTypes.CPU, SchedulerResourceTypes.GPU);
}
项目:hops    文件:ResourceCalculatorUtils.java   
public static int computeAvailableContainers(Resource available,
    Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.min(
      calculateRatioOrMaxValue(available.getMemorySize(), required.getMemorySize()),
      calculateRatioOrMaxValue(available.getVirtualCores(), required
          .getVirtualCores()));
  }
  return calculateRatioOrMaxValue(
    available.getMemorySize(), required.getMemorySize());
}
项目:hops    文件:ResourceCalculatorUtils.java   
public static int divideAndCeilContainers(Resource required, Resource factor,
    EnumSet<SchedulerResourceTypes> resourceTypes) {
  if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
    return Math.max(divideAndCeil(required.getMemorySize(), factor.getMemorySize()),
      divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
  }
  return divideAndCeil(required.getMemorySize(), factor.getMemorySize());
}
项目:hops    文件:RMCommunicator.java   
public RMCommunicator(ClientService clientService, AppContext context) {
  super("RMCommunicator");
  this.clientService = clientService;
  this.context = context;
  this.eventHandler = context.getEventHandler();
  this.applicationId = context.getApplicationID();
  this.stopped = new AtomicBoolean(false);
  this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
  this.schedulerResourceTypes = EnumSet.of(SchedulerResourceTypes.MEMORY);
}
项目:tez    文件:HadoopShim27.java   
@Override
public Set<String> getSupportedResourceTypes(RegisterApplicationMasterResponse response) {
  EnumSet<SchedulerResourceTypes> supportedResourceTypes = response.getSchedulerResourceTypes();
  Set<String> supportedTypes = new HashSet<String>();
  for (SchedulerResourceTypes resourceType : supportedResourceTypes) {
    supportedTypes.add(resourceType.name());
  }
  return supportedTypes;
}