use of com.alibaba.maxgraph.rpc.MaxGraphCtrlServiceGrpc.MaxGraphCtrlServiceBlockingStub in project GraphScope by alibaba.
the class RpcConnector method showProcessList.
public void showProcessList(TimelyResultProcessor resultProcessor) throws Exception {
MaxGraphCtrlServiceBlockingStub stub = randomCtrlStub(getTargetExecutorAddrs().get(0));
ShowProcessListResponse resp = stub.showProcessList(ShowProcessListRequest.newBuilder().build());
List<QueryResult> processNameList = Lists.newArrayList();
for (RunningQuery runningQuery : resp.getQueriesList()) {
processNameList.add(new PropertyValueResult(runningQuery.getQueryId() + "[" + runningQuery.getScript() + "][" + runningQuery.getElapsedNano() / 1000000 + "ms]"));
}
ListResult listResult = new ListResult(processNameList);
resultProcessor.process(listResult);
resultProcessor.finish();
}
use of com.alibaba.maxgraph.rpc.MaxGraphCtrlServiceGrpc.MaxGraphCtrlServiceBlockingStub in project GraphScope by alibaba.
the class RpcConnector method cancelDataflowByFront.
public void cancelDataflowByFront(int frontId, List<Endpoint> serverList) throws Exception {
for (Endpoint entry : serverList) {
IpPort address = IpPort.fromCtrlAndAsyncEndpoint(entry);
ManagedChannel randomChannel = channels.get(address).get(RandomUtils.nextInt(0, channelCount)).getRight();
MaxGraphCtrlServiceBlockingStub stub = MaxGraphCtrlServiceGrpc.newBlockingStub(randomChannel);
CancelDataflowResponse resp = stub.cancelDataflowByFront(GremlinService.CancelDataflowByFrontRequest.newBuilder().setFrontId(frontId).build());
if (!resp.getSuccess()) {
throw new RuntimeException("request cancelDataflowByFront to server " + address + " by frontend " + frontId + " fail: " + resp.getMessage());
}
}
}
use of com.alibaba.maxgraph.rpc.MaxGraphCtrlServiceGrpc.MaxGraphCtrlServiceBlockingStub in project GraphScope by alibaba.
the class RpcConnector method hasCancelDataFlowByFrontCompleted.
public boolean hasCancelDataFlowByFrontCompleted(int frontId, List<Endpoint> serverList) throws Exception {
for (Endpoint entry : serverList) {
IpPort address = IpPort.fromCtrlAndAsyncEndpoint(entry);
ManagedChannel randomChannel = channels.get(address).get(RandomUtils.nextInt(0, channelCount)).getRight();
MaxGraphCtrlServiceBlockingStub stub = MaxGraphCtrlServiceGrpc.newBlockingStub(randomChannel);
ShowProcessListResponse resp = stub.showProcessList(ShowProcessListRequest.newBuilder().build());
// resp.getQueriesList());
for (RunningQuery runningQuery : resp.getQueriesList()) {
if (runningQuery.getFrontId() == frontId) {
return false;
}
}
}
return true;
}
use of com.alibaba.maxgraph.rpc.MaxGraphCtrlServiceGrpc.MaxGraphCtrlServiceBlockingStub in project GraphScope by alibaba.
the class RpcConnector method cancelDataflow.
public void cancelDataflow(TimelyResultProcessor resultProcessor, String queryId) throws Exception {
List<Endpoint> executorAddrList = getTargetExecutorAddrs();
String logMsg = new String("");
boolean isSuccess = false;
for (int i = 0; i < executorAddrList.size(); i++) {
MaxGraphCtrlServiceBlockingStub stub = randomCtrlStub(executorAddrList.get(i));
CancelDataflowResponse resp = stub.cancelDataflow(CancelDataflowRequest.newBuilder().setQueryId(queryId).build());
if (resp.getSuccess()) {
isSuccess = true;
logMsg = String.format("Cancel %s in worker %d success.", queryId, i);
} else {
logMsg = String.format("Cancel %s in worker %d failed.", queryId, i);
}
LOG.info(logMsg);
}
String resultMsg;
if (isSuccess) {
resultMsg = "Cancel success.";
} else {
resultMsg = "Cancel failed.";
}
resultProcessor.process(new PropertyValueResult(resultMsg));
resultProcessor.finish();
}
Aggregations