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

项目:hops    文件:DBRMStateStore.java   
private void loadReservationSystemState(RMState rmState) throws IOException {

    ReservationStateDataAccess DA = (ReservationStateDataAccess) RMStorageFactory.getDataAccess(
        ReservationStateDataAccess.class);

    List<ReservationState> reservationStates = DA.getAll();

    for (ReservationState state : reservationStates) {

      if (!rmState.getReservationState().containsKey(state.getPlanName())) {
        rmState.getReservationState().put(state.getPlanName(),
            new HashMap<ReservationId, YarnProtos.ReservationAllocationStateProto>());
      };
      rmState.getReservationState().get(state.getPlanName()).put(ReservationId.parseReservationId(state.
          getReservationIdName()), YarnProtos.ReservationAllocationStateProto.parseFrom(state.getState()));
    }

  }
项目:hops    文件:DBRMStateStore.java   
protected void storeReservationState(final YarnProtos.ReservationAllocationStateProto reservationAllocation,
    final String planName, final String reservationIdName) throws Exception {

  LightWeightRequestHandler storeReservationStateHandler = new LightWeightRequestHandler(YARNOperationType.TEST) {
    @Override
    public Object performTask() throws StorageException {
      connector.beginTransaction();
      connector.writeLock();
      ReservationStateDataAccess DA = (ReservationStateDataAccess) RMStorageFactory.getDataAccess(
          ReservationStateDataAccess.class);

      DA.add(new ReservationState(reservationAllocation.toByteArray(), planName, reservationIdName));

      connector.commit();
      return null;
    }
  };
  storeReservationStateHandler.handle();
}
项目:incubator-tajo    文件:TajoWorkerContainerId.java   
public YarnProtos.ContainerIdProto getProto() {
  YarnProtos.ApplicationIdProto appIdProto = YarnProtos.ApplicationIdProto.newBuilder()
      .setClusterTimestamp(applicationAttemptId.getApplicationId().getClusterTimestamp())
      .setId(applicationAttemptId.getApplicationId().getId())
      .build();

  YarnProtos.ApplicationAttemptIdProto attemptIdProto = YarnProtos.ApplicationAttemptIdProto.newBuilder()
      .setAttemptId(applicationAttemptId.getAttemptId())
      .setApplicationId(appIdProto)
      .build();

  return YarnProtos.ContainerIdProto.newBuilder()
      .setAppAttemptId(attemptIdProto)
      .setAppId(appIdProto)
      .setId(id)
      .build();
}
项目:incubator-tajo    文件:TajoWorkerContainerId.java   
public static YarnProtos.ContainerIdProto getContainerIdProto(ContainerId containerId) {
  if(containerId instanceof TajoWorkerContainerId) {
    return ((TajoWorkerContainerId)containerId).getProto();
  } else {
    YarnProtos.ApplicationIdProto appIdProto = YarnProtos.ApplicationIdProto.newBuilder()
        .setClusterTimestamp(containerId.getApplicationAttemptId().getApplicationId().getClusterTimestamp())
        .setId(containerId.getApplicationAttemptId().getApplicationId().getId())
        .build();

    YarnProtos.ApplicationAttemptIdProto attemptIdProto = YarnProtos.ApplicationAttemptIdProto.newBuilder()
        .setAttemptId(containerId.getApplicationAttemptId().getAttemptId())
        .setApplicationId(appIdProto)
        .build();

    return YarnProtos.ContainerIdProto.newBuilder()
        .setAppAttemptId(attemptIdProto)
        .setAppId(appIdProto)
        .setId(containerId.getId())
        .build();
  }
}
项目:tajo-cdh    文件:TajoWorkerContainerId.java   
public YarnProtos.ContainerIdProto getProto() {
  YarnProtos.ApplicationIdProto appIdProto = YarnProtos.ApplicationIdProto.newBuilder()
      .setClusterTimestamp(applicationAttemptId.getApplicationId().getClusterTimestamp())
      .setId(applicationAttemptId.getApplicationId().getId())
      .build();

  YarnProtos.ApplicationAttemptIdProto attemptIdProto = YarnProtos.ApplicationAttemptIdProto.newBuilder()
      .setAttemptId(applicationAttemptId.getAttemptId())
      .setApplicationId(appIdProto)
      .build();

  return YarnProtos.ContainerIdProto.newBuilder()
      .setAppAttemptId(attemptIdProto)
      .setAppId(appIdProto)
      .setId(id)
      .build();
}
项目:tajo-cdh    文件:TajoWorkerContainerId.java   
public static YarnProtos.ContainerIdProto getContainerIdProto(ContainerId containerId) {
  if(containerId instanceof TajoWorkerContainerId) {
    return ((TajoWorkerContainerId)containerId).getProto();
  } else {
    YarnProtos.ApplicationIdProto appIdProto = YarnProtos.ApplicationIdProto.newBuilder()
        .setClusterTimestamp(containerId.getApplicationAttemptId().getApplicationId().getClusterTimestamp())
        .setId(containerId.getApplicationAttemptId().getApplicationId().getId())
        .build();

    YarnProtos.ApplicationAttemptIdProto attemptIdProto = YarnProtos.ApplicationAttemptIdProto.newBuilder()
        .setAttemptId(containerId.getApplicationAttemptId().getAttemptId())
        .setApplicationId(appIdProto)
        .build();

    return YarnProtos.ContainerIdProto.newBuilder()
        .setAppAttemptId(attemptIdProto)
        .setAppId(appIdProto)
        .setId(containerId.getId())
        .build();
  }
}
项目:tajo-cdh    文件:TajoWorkerResourceManager.java   
@Override
public void releaseWorkerResource(ExecutionBlockId ebId, YarnProtos.ContainerIdProto containerId) {
  synchronized(workerResourceLock) {
    AllocatedWorkerResource allocatedWorkerResource = allocatedResourceMap.get(containerId);
    if(allocatedWorkerResource != null) {
      LOG.info("Release Resource:" + ebId + "," +
          allocatedWorkerResource.allocatedDiskSlots + "," + allocatedWorkerResource.allocatedMemoryMB);
      allocatedWorkerResource.workerResource.releaseResource(
          allocatedWorkerResource.allocatedDiskSlots, allocatedWorkerResource.allocatedMemoryMB);
    } else {
      LOG.warn("No AllocatedWorkerResource data for [" + ebId + "," + containerId + "]");
      return;
    }
  }

  synchronized(reAllocationList) {
    reAllocationList.notifyAll();
  }
}
项目:hops    文件:AllocateRequestPBImpl.java   
private void initIncreaseRequests() {
  if (this.deprecatedIncreaseReqs != null) {
    return;
  }
  AllocateRequestProtoOrBuilder p = viaProto ? proto : builder;
  List<YarnProtos.ContainerResourceIncreaseRequestProto> list =
      p.getIncreaseRequestList();
  this.deprecatedIncreaseReqs = new ArrayList<>();

  for (YarnProtos.ContainerResourceIncreaseRequestProto c : list) {
    this.deprecatedIncreaseReqs.add(convertFromProtoFormat(c));
  }
}
项目:hops    文件:AllocateRequestPBImpl.java   
private void addIncreaseRequestsToProto() {
  maybeInitBuilder();
  builder.clearIncreaseRequest();
  if (deprecatedIncreaseReqs == null) {
    return;
  }
  Iterable<YarnProtos.ContainerResourceIncreaseRequestProto> iterable =
      new Iterable<YarnProtos.ContainerResourceIncreaseRequestProto>() {
        @Override
        public Iterator<YarnProtos.ContainerResourceIncreaseRequestProto> iterator() {
          return new Iterator<YarnProtos.ContainerResourceIncreaseRequestProto>() {

            private Iterator<ContainerResourceIncreaseRequest> iter =
                deprecatedIncreaseReqs.iterator();

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

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

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

        }
      };
  builder.addAllIncreaseRequest(iterable);
}
项目:hops    文件:ProtoUtils.java   
public static ContainerStatusPBImpl convertFromProtoFormat(
    YarnProtos.ContainerStatusProto p) {
  return new ContainerStatusPBImpl(p);
}
项目:tajo    文件:ApplicationIdUtils.java   
public static QueryId appIdToQueryId(YarnProtos.ApplicationIdProto appId) {
  return QueryIdFactory.newQueryId(appId.getClusterTimestamp(), appId.getId());
}
项目:incubator-tajo    文件:TajoContainerProxy.java   
public static void releaseWorkerResource(QueryMasterTask.QueryMasterTaskContext context,
                                         ExecutionBlockId executionBlockId,
                                         List<ContainerId> containerIds) throws Exception {
  List<YarnProtos.ContainerIdProto> containerIdProtos =
      new ArrayList<YarnProtos.ContainerIdProto>();

  for(ContainerId eachContainerId: containerIds) {
    containerIdProtos.add(TajoWorkerContainerId.getContainerIdProto(eachContainerId));
  }

  RpcConnectionPool connPool = RpcConnectionPool.getPool(context.getConf());
  NettyClientBase tmClient = null;
  try {
      tmClient = connPool.getConnection(context.getQueryMasterContext().getWorkerContext().getTajoMasterAddress(),
          TajoMasterProtocol.class, true);
      TajoMasterProtocol.TajoMasterProtocolService masterClientService = tmClient.getStub();
      masterClientService.releaseWorkerResource(null,
        TajoMasterProtocol.WorkerResourceReleaseRequest.newBuilder()
            .setExecutionBlockId(executionBlockId.getProto())
            .addAllContainerIds(containerIdProtos)
            .build(),
        NullCallback.get());
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
  } finally {
    connPool.releaseConnection(tmClient);
  }
}
项目:incubator-tajo    文件:TajoMasterService.java   
@Override
public void releaseWorkerResource(RpcController controller,
                                       TajoMasterProtocol.WorkerResourceReleaseRequest request,
                                       RpcCallback<PrimitiveProtos.BoolProto> done) {
  List<YarnProtos.ContainerIdProto> containerIds = request.getContainerIdsList();

  for(YarnProtos.ContainerIdProto eachContainer: containerIds) {
    context.getResourceManager().releaseWorkerResource(eachContainer);
  }
  done.run(BOOL_TRUE);
}
项目:incubator-tajo    文件:YarnTajoResourceManager.java   
@Override
public void releaseWorkerResource(YarnProtos.ContainerIdProto containerId) {
  throw new UnimplementedException("releaseWorkerResource");
}
项目:incubator-tajo    文件:TajoResourceAllocator.java   
@Override
public ContainerId makeContainerId(YarnProtos.ContainerIdProto containerIdProto) {
  TajoWorkerContainerId containerId = new TajoWorkerContainerId();
  ApplicationAttemptId appAttemptId = new ApplicationAttemptIdPBImpl(containerIdProto.getAppAttemptId());
  containerId.setApplicationAttemptId(appAttemptId);
  containerId.setId(containerIdProto.getId());
  return containerId;
}
项目:tajo-cdh    文件:TajoContainerProxy.java   
public static void releaseWorkerResource(QueryMasterTask.QueryMasterTaskContext context,
                                         ExecutionBlockId executionBlockId,
                                         List<ContainerId> containerIds) throws Exception {
  List<YarnProtos.ContainerIdProto> containerIdProtos =
      new ArrayList<YarnProtos.ContainerIdProto>();

  for(ContainerId eachContainerId: containerIds) {
    containerIdProtos.add(TajoWorkerContainerId.getContainerIdProto(eachContainerId));
  }

  RpcConnectionPool connPool = RpcConnectionPool.getPool(context.getConf());
  NettyClientBase tmClient = null;
  try {
      tmClient = connPool.getConnection(context.getQueryMasterContext().getWorkerContext().getTajoMasterAddress(),
          TajoMasterProtocol.class, true);
      TajoMasterProtocol.TajoMasterProtocolService masterClientService = tmClient.getStub();
      masterClientService.releaseWorkerResource(null,
        TajoMasterProtocol.WorkerResourceReleaseRequest.newBuilder()
            .setExecutionBlockId(executionBlockId.getProto())
            .addAllContainerIds(containerIdProtos)
            .build(),
        NullCallback.get());
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
  } finally {
    connPool.releaseConnection(tmClient);
  }
}
项目:tajo-cdh    文件:TajoMasterService.java   
@Override
public void releaseWorkerResource(RpcController controller,
                                       TajoMasterProtocol.WorkerResourceReleaseRequest request,
                                       RpcCallback<PrimitiveProtos.BoolProto> done) {
  List<YarnProtos.ContainerIdProto> containerIds = request.getContainerIdsList();
  ExecutionBlockId ebId = new ExecutionBlockId(request.getExecutionBlockId());

  for(YarnProtos.ContainerIdProto eachContainer: containerIds) {
    context.getResourceManager().releaseWorkerResource(ebId, eachContainer);
  }
  done.run(BOOL_TRUE);
}
项目:tajo-cdh    文件:ApplicationIdUtils.java   
public static QueryId appIdToQueryId(YarnProtos.ApplicationIdProto appId) {
  return QueryIdFactory.newQueryId(appId.getClusterTimestamp(), appId.getId());
}
项目:tajo-cdh    文件:TajoResourceAllocator.java   
@Override
public ContainerId makeContainerId(YarnProtos.ContainerIdProto containerIdProto) {
  TajoWorkerContainerId containerId = new TajoWorkerContainerId();
  ApplicationAttemptId appAttemptId = new ApplicationAttemptIdPBImpl(containerIdProto.getAppAttemptId());
  containerId.setApplicationAttemptId(appAttemptId);
  containerId.setId(containerIdProto.getId());
  return containerId;
}
项目:aliyun-oss-hadoop-fs    文件:ReservationSystemUtil.java   
public static ResourceProto convertToProtoFormat(Resource e) {
  return YarnProtos.ResourceProto.newBuilder()
      .setMemory(e.getMemory())
      .setVirtualCores(e.getVirtualCores())
      .build();
}
项目:hops    文件:AllocateRequestPBImpl.java   
private ContainerResourceIncreaseRequestPBImpl convertFromProtoFormat(
    YarnProtos.ContainerResourceIncreaseRequestProto p) {
  return new ContainerResourceIncreaseRequestPBImpl(p);

}
项目:hops    文件:AllocateRequestPBImpl.java   
private YarnProtos.ContainerResourceIncreaseRequestProto convertToProtoFormat(
    ContainerResourceIncreaseRequest t) {
  return ((ContainerResourceIncreaseRequestPBImpl) t).getProto();

}
项目:hops    文件:ProtoUtils.java   
public static YarnProtos.ContainerProto convertToProtoFormat(
    Container t) {
  return ((ContainerPBImpl)t).getProto();
}
项目:hops    文件:ProtoUtils.java   
public static ContainerPBImpl convertFromProtoFormat(
    YarnProtos.ContainerProto t) {
  return new ContainerPBImpl(t);
}
项目:hops    文件:ReservationSystemUtil.java   
public static ResourceProto convertToProtoFormat(Resource e) {
  return YarnProtos.ResourceProto.newBuilder()
      .setMemory(e.getMemorySize())
      .setVirtualCores(e.getVirtualCores())
      .build();
}
项目:incubator-tajo    文件:YarnResourceAllocator.java   
@Override
public ContainerId makeContainerId(YarnProtos.ContainerIdProto containerId) {
  return new ContainerIdPBImpl(containerId);
}
项目:tajo-cdh    文件:YarnTajoResourceManager.java   
@Override
public void releaseWorkerResource(ExecutionBlockId ebId, YarnProtos.ContainerIdProto containerId) {
  throw new UnimplementedException("releaseWorkerResource");
}
项目:tajo-cdh    文件:YarnResourceAllocator.java   
@Override
public ContainerId makeContainerId(YarnProtos.ContainerIdProto containerId) {
  return new ContainerIdPBImpl(containerId);
}
项目:incubator-tajo    文件:ApplicationIdUtils.java   
public static QueryId appIdToQueryId(YarnProtos.ApplicationIdProto appId) {
  return QueryIdFactory.newQueryId(appId.getClusterTimestamp(), appId.getId());
}
项目:incubator-tajo    文件:ResourceAllocator.java   
public ContainerId makeContainerId(YarnProtos.ContainerIdProto containerId);
项目:tajo-cdh    文件:ResourceAllocator.java   
public ContainerId makeContainerId(YarnProtos.ContainerIdProto containerId);