Search in sources :

Example 1 with GetPartLocationResponse

use of com.tencent.angel.protobuf.generated.MLProtos.GetPartLocationResponse in project angel by Tencent.

the class MasterService method getPartLocation.

/**
 * Get locations for a partition
 */
@Override
public GetPartLocationResponse getPartLocation(RpcController controller, GetPartLocationRequest request) throws ServiceException {
    GetPartLocationResponse.Builder builder = GetPartLocationResponse.newBuilder();
    List<ParameterServerId> psIds = context.getMatrixMetaManager().getPss(request.getMatrixId(), request.getPartId());
    if (psIds != null) {
        int size = psIds.size();
        for (int i = 0; i < size; i++) {
            Location psLocation = context.getLocationManager().getPsLocation(psIds.get(i));
            if (psLocation == null) {
                builder.addLocations((PSLocationProto.newBuilder().setPsId(ProtobufUtil.convertToIdProto(psIds.get(i))).setPsStatus(PSStatus.PS_NOTREADY).build()));
            } else {
                builder.addLocations(ProtobufUtil.convertToPSLocProto(psIds.get(i), psLocation));
            }
        }
    }
    return builder.build();
}
Also used : GetPartLocationResponse(com.tencent.angel.protobuf.generated.MLProtos.GetPartLocationResponse) ParameterServerId(com.tencent.angel.ps.ParameterServerId) PSLocation(com.tencent.angel.ps.server.data.PSLocation) Location(com.tencent.angel.common.location.Location)

Aggregations

Location (com.tencent.angel.common.location.Location)1 GetPartLocationResponse (com.tencent.angel.protobuf.generated.MLProtos.GetPartLocationResponse)1 ParameterServerId (com.tencent.angel.ps.ParameterServerId)1 PSLocation (com.tencent.angel.ps.server.data.PSLocation)1