Search in sources :

Example 1 with GetPSLocationReponse

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

the class MasterService method getPSLocation.

/**
 * get a specific parameter server location.
 *
 * @param controller rpc controller of protobuf
 * @param request parameter server id
 */
@Override
public GetPSLocationReponse getPSLocation(RpcController controller, GetPSLocationRequest request) throws ServiceException {
    GetPSLocationReponse.Builder resBuilder = GetPSLocationReponse.newBuilder();
    ParameterServerId psId = ProtobufUtil.convertToId(request.getPsId());
    Location psLocation = context.getLocationManager().getPsLocation(psId);
    if (psLocation == null) {
        resBuilder.setPsLocation(PSLocationProto.newBuilder().setPsId(request.getPsId()).setPsStatus(PSStatus.PS_NOTREADY).build());
    } else {
        resBuilder.setPsLocation(ProtobufUtil.convertToPSLocProto(psId, psLocation));
    }
    return resBuilder.build();
}
Also used : GetPSLocationReponse(com.tencent.angel.protobuf.generated.MLProtos.GetPSLocationReponse) 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 GetPSLocationReponse (com.tencent.angel.protobuf.generated.MLProtos.GetPSLocationReponse)1 ParameterServerId (com.tencent.angel.ps.ParameterServerId)1 PSLocation (com.tencent.angel.ps.server.data.PSLocation)1