Search in sources :

Example 1 with WorkerGroupMetaInfoProto

use of com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.WorkerGroupMetaInfoProto in project angel by Tencent.

the class ProtobufUtil method buildWorkerGroupMeta.

private static WorkerGroupMetaInfoProto buildWorkerGroupMeta(AMWorkerGroup group, SplitClassification splits, Configuration conf) throws IOException {
    WorkerGroupMetaInfoProto.Builder builder = WorkerGroupMetaInfoProto.newBuilder();
    builder.setWorkerGroupId(convertToIdProto(group.getId()));
    builder.setLeaderId(convertToIdProto(group.getLeader()));
    for (AMWorker w : group.getWorkerSet()) {
        builder.addWorkers(buildWorkerMetaProto(w));
    }
    if (splits != null) {
        List<SplitInfo> splitInfoList = SerdeUtils.serilizeSplits(splits, conf);
        SplitInfoProto.Builder splitBuilder = SplitInfoProto.newBuilder();
        for (SplitInfo split : splitInfoList) {
            builder.addSplits(splitBuilder.setSplitClass(split.getSplitClass()).setSplit(ByteString.copyFrom(split.getSplit())).build());
        }
    }
    return builder.build();
}
Also used : WorkerGroupMetaInfoProto(com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.WorkerGroupMetaInfoProto) SplitInfoProto(com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.SplitInfoProto) AMWorker(com.tencent.angel.master.worker.worker.AMWorker) SplitInfo(com.tencent.angel.split.SplitInfo)

Aggregations

AMWorker (com.tencent.angel.master.worker.worker.AMWorker)1 SplitInfoProto (com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.SplitInfoProto)1 WorkerGroupMetaInfoProto (com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.WorkerGroupMetaInfoProto)1 SplitInfo (com.tencent.angel.split.SplitInfo)1