use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class MatrixTransportClient method removePendingRPCS.
private void removePendingRPCS(PSLocation psLoc) {
Iterator<Entry<Integer, SendResultKey>> iter = seqIdToSendCFMap.entrySet().iterator();
Entry<Integer, SendResultKey> entry;
while (iter.hasNext()) {
entry = iter.next();
if (entry.getValue().psLoc.equals(psLoc)) {
SendResultKey sendResultKey = seqIdToSendCFMap.get(entry.getKey());
Request request = seqIdToRequestMap.get(entry.getKey());
if (request != null && request.getContext().getChannel() != null) {
sendResultKey.cf.cancel(true);
}
requestFailed(entry.getKey(), ResponseType.NETWORK_ERROR, "Server no response");
}
}
}
use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class MatrixTransportClient method get.
@Override
public FutureResult<PartitionGetResult> get(GetFunc func, PartitionGetParam param) {
// Request header
RequestHeader header = createRequestHeader(-1, TransportMethod.GET_PSF, param.getMatrixId(), param.getPartKey().getPartitionId());
// Request body
GetUDFRequest requestData = new GetUDFRequest(func.getClass().getName(), param);
// Request
Request request = new Request(header, requestData);
FutureResult<PartitionGetResult> resultFuture = new FutureResult<>();
requestToResultMap.put(request, resultFuture);
// Send the request
sendGetRequest(request);
return resultFuture;
}
use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class MatrixTransportClient method requestSuccess.
private void requestSuccess(int seqId) {
Request request = seqIdToRequestMap.remove(seqId);
if (request == null) {
return;
}
rpcContext.after(request.getContext().getServerId());
seqIdToSendCFMap.remove(seqId);
returnChannel(request);
switch(request.getType()) {
case GET_PART:
case GET_ROWSPLIT:
case GET_ROWSSPLIT:
case GET_PSF:
case INDEX_GET_ROW:
case INDEX_GET_ROWS:
getRequestSuccess(request);
break;
case PUT_PART:
case UPDATE:
case UPDATE_PSF:
putRequestSuccess(request);
break;
default:
LOG.error("unvalid response for request " + request + " with seqId " + seqId);
break;
}
}
use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class UserRequestAdapter method sendGetRowsRequest.
private void sendGetRowsRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int[] rowIds, int partId) {
// Request header
RequestHeader header = createRequestHeader(userRequestId, TransportMethod.GET_ROWSSPLIT, matrixId, partId);
// Request body
GetRowsSplitRequest requestData = new GetRowsSplitRequest(rowIds);
// Request
Request request = new Request(header, requestData);
// Send the request
matrixClient.sendGetRequest(request);
}
use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class UserRequestAdapter method sendGetRowRequest.
private void sendGetRowRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int rowId, int partId) {
// Request header
RequestHeader header = createRequestHeader(userRequestId, TransportMethod.GET_ROWSPLIT, matrixId, partId);
// Request body
GetRowSplitRequest requestData = new GetRowSplitRequest(rowId);
// Request
Request request = new Request(header, requestData);
// Send the request
matrixClient.sendGetRequest(request);
}
Aggregations