use of com.tencent.angel.protobuf.generated.MLProtos.GetAllPSLocationResponse in project angel by Tencent.
the class AngelClient method waitForAllPS.
protected void waitForAllPS(int psNumber) throws ServiceException, InterruptedException {
boolean isAllPSReady = true;
while (true) {
GetAllPSLocationResponse response = master.getAllPSLocation(null, GetAllPSLocationRequest.newBuilder().build());
List<PSLocationProto> psLocs = response.getPsLocationsList();
int size = psLocs.size();
if (size == psNumber) {
isAllPSReady = true;
for (int i = 0; i < size; i++) {
if (psLocs.get(i).getPsStatus() == PSStatus.PS_NOTREADY) {
isAllPSReady = false;
break;
}
}
if (isAllPSReady) {
return;
}
}
Thread.sleep(100);
}
}
use of com.tencent.angel.protobuf.generated.MLProtos.GetAllPSLocationResponse in project angel by Tencent.
the class MasterService method getAllPSLocation.
/**
* get all parameter server locations.
*
* @param controller rpc controller of protobuf
*/
@Override
public GetAllPSLocationResponse getAllPSLocation(RpcController controller, GetAllPSLocationRequest request) {
GetAllPSLocationResponse.Builder resBuilder = GetAllPSLocationResponse.newBuilder();
LocationManager locationManager = context.getLocationManager();
ParameterServerId[] psIds = locationManager.getPsIds();
for (int i = 0; i < psIds.length; i++) {
resBuilder.addPsLocations(ProtobufUtil.convertToPSLocProto(psIds[i], locationManager.getPsLocation(psIds[i])));
}
return resBuilder.build();
}
Aggregations