use of alluxio.hub.proto.DetectPrestoRequest in project alluxio by Alluxio.
the class ManagerProcessContext method startDetectPrestoListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} DetectPresto RPC calls.
*/
public void startDetectPrestoListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<DetectPrestoRequest, DetectPrestoResponse>() {
@Override
public DetectPrestoResponse exec(DetectPrestoRequest req) {
return DetectPrestoResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(detectPresto(req)).build();
}
@Override
public void restart() {
startDetectPrestoListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<DetectPrestoResponse> responseObserver = asyncStub.detectPresto(requestObserver);
requestObserver.start(responseObserver, DetectPrestoResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started DetectPresto async listener", asyncStub);
}
use of alluxio.hub.proto.DetectPrestoRequest in project alluxio by Alluxio.
the class ManagerProcessContext method detectPresto.
private DetectPrestoResponse.Payload detectPresto(DetectPrestoRequest request) {
AgentDetectPrestoRequest detectRequest = AgentDetectPrestoRequest.newBuilder().setConfDir(request.getPayload().getConfDir()).build();
boolean workers = execOnHub(client -> client.detectPresto(detectRequest), AlluxioNodeType.WORKER).values().stream().map(AgentDetectPrestoResponse::getDetected).reduce(Boolean::logicalAnd).orElse(false);
boolean result = workers && execOnHub(client -> client.detectPresto(detectRequest), AlluxioNodeType.MASTER).values().stream().map(AgentDetectPrestoResponse::getDetected).reduce(Boolean::logicalAnd).orElse(false);
return DetectPrestoResponse.Payload.newBuilder().setDetected(result).build();
}
Aggregations