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


Java ResourcePBImpl类代码示例

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


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

示例1: mergeLocalToBuilder

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }

  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getResource())) {
    builder.setResource(convertToProtoFormat(this.resource));
  }

  if (this.priority != null) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:NMContainerStatusPBImpl.java

示例2: mergeLocalToBuilder

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:ContainerStartDataPBImpl.java

示例3: ContainerTokenIdentifier

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
public ContainerTokenIdentifier(ContainerId containerID, String hostName,
    String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId,
    long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierProto.Builder builder = 
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);
  
  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:ContainerTokenIdentifier.java

示例4: ContainerTokenIdentifierForTest

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
public ContainerTokenIdentifierForTest(ContainerId containerID,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);
  
  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:ContainerTokenIdentifierForTest.java

示例5: ContainerTokenIdentifier

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
public ContainerTokenIdentifier(ContainerId containerID, String hostName,
    String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId,
    long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext, String nodeLabelExpression,
    ContainerType containerType, ExecutionType executionType) {
  ContainerTokenIdentifierProto.Builder builder =
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);
  
  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  
  if (nodeLabelExpression != null) {
    builder.setNodeLabelExpression(nodeLabelExpression);
  }
  builder.setContainerType(convertToProtoFormat(containerType));
  builder.setExecutionType(convertToProtoFormat(executionType));

  proto = builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:37,代码来源:ContainerTokenIdentifier.java

示例6: loadContainerState

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private RecoveredContainerState loadContainerState(ContainerId containerId,
    LeveldbIterator iter, String keyPrefix) throws IOException {
  RecoveredContainerState rcs = new RecoveredContainerState();
  rcs.status = RecoveredContainerStatus.REQUESTED;
  while (iter.hasNext()) {
    Entry<byte[],byte[]> entry = iter.peekNext();
    String key = asString(entry.getKey());
    if (!key.startsWith(keyPrefix)) {
      break;
    }
    iter.next();

    String suffix = key.substring(keyPrefix.length()-1);  // start with '/'
    if (suffix.equals(CONTAINER_REQUEST_KEY_SUFFIX)) {
      rcs.startRequest = new StartContainerRequestPBImpl(
          StartContainerRequestProto.parseFrom(entry.getValue()));
    } else if (suffix.equals(CONTAINER_DIAGS_KEY_SUFFIX)) {
      rcs.diagnostics = asString(entry.getValue());
    } else if (suffix.equals(CONTAINER_LAUNCHED_KEY_SUFFIX)) {
      if (rcs.status == RecoveredContainerStatus.REQUESTED) {
        rcs.status = RecoveredContainerStatus.LAUNCHED;
      }
    } else if (suffix.equals(CONTAINER_KILLED_KEY_SUFFIX)) {
      rcs.killed = true;
    } else if (suffix.equals(CONTAINER_EXIT_CODE_KEY_SUFFIX)) {
      rcs.status = RecoveredContainerStatus.COMPLETED;
      rcs.exitCode = Integer.parseInt(asString(entry.getValue()));
    } else if (suffix.equals(CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX)) {
      rcs.capability = new ResourcePBImpl(
          ResourceProto.parseFrom(entry.getValue()));
    } else {
      throw new IOException("Unexpected container state key: " + key);
    }
  }
  return rcs;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:37,代码来源:NMLeveldbStateStoreService.java

示例7: storeContainerResourceChanged

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
@Override
public void storeContainerResourceChanged(ContainerId containerId,
    Resource capability) throws IOException {
  String key = CONTAINERS_KEY_PREFIX + containerId.toString()
      + CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX;
  try {
    // New value will overwrite old values for the same key
    db.put(bytes(key),
        ((ResourcePBImpl) capability).getProto().toByteArray());
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:14,代码来源:NMLeveldbStateStoreService.java

示例8: ContainerTokenIdentifier

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
public ContainerTokenIdentifier(ContainerId containerID, int containerVersion,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext, String nodeLabelExpression,
    ContainerType containerType, String appSubmitterFolder) {
  ContainerTokenIdentifierProto.Builder builder =
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setVersion(containerVersion);
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  builder.setAppSubmitterFolder(appSubmitterFolder);
  
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);
  
  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  
  if (nodeLabelExpression != null) {
    builder.setNodeLabelExpression(nodeLabelExpression);
  }
  builder.setContainerType(convertToProtoFormat(containerType));

  proto = builder.build();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:ContainerTokenIdentifier.java

示例9: loadContainerState

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private RecoveredContainerState loadContainerState(ContainerId containerId,
    LeveldbIterator iter, String keyPrefix) throws IOException {
  RecoveredContainerState rcs = new RecoveredContainerState();
  rcs.status = RecoveredContainerStatus.REQUESTED;
  while (iter.hasNext()) {
    Entry<byte[],byte[]> entry = iter.peekNext();
    String key = asString(entry.getKey());
    if (!key.startsWith(keyPrefix)) {
      break;
    }
    iter.next();

    String suffix = key.substring(keyPrefix.length()-1);  // start with '/'
    if (suffix.equals(CONTAINER_REQUEST_KEY_SUFFIX)) {
      rcs.startRequest = new StartContainerRequestPBImpl(
          StartContainerRequestProto.parseFrom(entry.getValue()));
    } else if (suffix.equals(CONTAINER_VERSION_KEY_SUFFIX)) {
      rcs.version = Integer.parseInt(asString(entry.getValue()));
    } else if (suffix.equals(CONTAINER_DIAGS_KEY_SUFFIX)) {
      rcs.diagnostics = asString(entry.getValue());
    } else if (suffix.equals(CONTAINER_LAUNCHED_KEY_SUFFIX)) {
      if (rcs.status == RecoveredContainerStatus.REQUESTED) {
        rcs.status = RecoveredContainerStatus.LAUNCHED;
      }
    } else if (suffix.equals(CONTAINER_KILLED_KEY_SUFFIX)) {
      rcs.killed = true;
    } else if (suffix.equals(CONTAINER_EXIT_CODE_KEY_SUFFIX)) {
      rcs.status = RecoveredContainerStatus.COMPLETED;
      rcs.exitCode = Integer.parseInt(asString(entry.getValue()));
    } else if (suffix.equals(CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX)) {
      rcs.capability = new ResourcePBImpl(
          ResourceProto.parseFrom(entry.getValue()));
    } else {
      throw new IOException("Unexpected container state key: " + key);
    }
  }
  return rcs;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:NMLeveldbStateStoreService.java

示例10: storeContainerResourceChanged

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
@Override
public void storeContainerResourceChanged(ContainerId containerId,
    int containerVersion, Resource capability) throws IOException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("storeContainerResourceChanged: containerId=" + containerId
        + ", capability=" + capability);
  }

  String keyResChng = CONTAINERS_KEY_PREFIX + containerId.toString()
      + CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX;
  String keyVersion = CONTAINERS_KEY_PREFIX + containerId.toString()
      + CONTAINER_VERSION_KEY_SUFFIX;
  try {
    WriteBatch batch = db.createWriteBatch();
    try {
      // New value will overwrite old values for the same key
      batch.put(bytes(keyResChng),
          ((ResourcePBImpl) capability).getProto().toByteArray());
      batch.put(bytes(keyVersion), bytes(Integer.toString(containerVersion)));
      db.write(batch);
    } finally {
      batch.close();
    }
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:28,代码来源:NMLeveldbStateStoreService.java

示例11: setUp

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  NodeStore store = new NodeStore();
  NodeIdProto nodeId = NodeIdProto.newBuilder().setHost("localhost").setPort(8000).build();
  RMNode rmNode = new RMNodeImpl(new NodeIdPBImpl(nodeId), new MockRMContext(), "localhost", 8000, 8070, new NodeBase(),
          new ResourcePBImpl(), "1.0");
  SchedulerNode node = new FiCaSchedulerNode(rmNode, false);
  store.add(node);
  manager = new OfferLifecycleManager(store, new MyriadDriver(new MockSchedulerDriver()));
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:11,代码来源:OfferLifeCycleManagerTest.java

示例12: getResource

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
public Resource getResource() {
  if (!proto.hasResource()) {
    return null;
  }
  return new ResourcePBImpl(proto.getResource());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:ContainerTokenIdentifier.java

示例13: convertFromProtoFormat

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private Resource convertFromProtoFormat(ResourceProto resource) {
  return new ResourcePBImpl(resource);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:RegisterApplicationMasterResponsePBImpl.java

示例14: convertToProtoFormat

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private ResourceProto convertToProtoFormat(Resource resource) {
  return ((ResourcePBImpl)resource).getProto();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:RegisterApplicationMasterResponsePBImpl.java

示例15: convertFromProtoFormat

import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; //导入依赖的package包/类
private Resource convertFromProtoFormat(ResourceProto resource) {
 return new ResourcePBImpl(resource);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:4,代码来源:GetNewApplicationResponsePBImpl.java


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