Search in sources :

Example 1 with PSLocationProto

use of com.tencent.angel.protobuf.generated.MLProtos.PSLocationProto 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);
    }
}
Also used : GetAllPSLocationResponse(com.tencent.angel.protobuf.generated.MLProtos.GetAllPSLocationResponse) PSLocationProto(com.tencent.angel.protobuf.generated.MLProtos.PSLocationProto)

Aggregations

GetAllPSLocationResponse (com.tencent.angel.protobuf.generated.MLProtos.GetAllPSLocationResponse)1 PSLocationProto (com.tencent.angel.protobuf.generated.MLProtos.PSLocationProto)1