use of com.tencent.angel.protobuf.generated.ClientMasterServiceProtos.CheckModelSavedResponse in project angel by Tencent.
the class MasterService method checkModelSaved.
/**
* Check save request is complete
*/
@Override
public CheckModelSavedResponse checkModelSaved(RpcController controller, CheckModelSavedRequest request) throws ServiceException {
LOG.info("check model saved=" + request);
ModelSaveResult result = context.getModelSaver().getModelSaveResult(request.getRequestId());
if (result == null) {
throw new ServiceException("can not find save request " + request.getRequestId());
} else {
CheckModelSavedResponse.Builder builder = CheckModelSavedResponse.newBuilder();
builder.setStatus(result.getState().getStateId());
if (result.getMessage() != null) {
builder.setLog(result.getMessage());
}
return builder.build();
}
}
use of com.tencent.angel.protobuf.generated.ClientMasterServiceProtos.CheckModelSavedResponse in project angel by Tencent.
the class AngelClient method isSaveCompleted.
/**
* Check a save request complete or not
*
* @param requestId save request id
* @return true means complete
*/
private boolean isSaveCompleted(int requestId) throws AngelException {
CheckModelSavedResponse response;
try {
response = master.checkModelSaved(null, CheckModelSavedRequest.newBuilder().setRequestId(requestId).build());
} catch (Throwable x) {
throw new AngelException("Check model save request failed ", x);
}
SaveState state = SaveState.valueOf(response.getStatus());
if (state == SaveState.FAILED) {
throw new AngelException("Model save falied " + response.getLog());
} else if (state == SaveState.SUCCESS) {
return true;
} else {
return false;
}
}
Aggregations