use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class UserRequestAdapter method sendIndexGetRowsRequest.
private void sendIndexGetRowsRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int[] rowIds, int partId, KeyPart keyPart, InitFunc func) {
// Request header
RequestHeader header = createRequestHeader(userRequestId, TransportMethod.INDEX_GET_ROWS, matrixId, partId);
// Request body
IndexPartGetRowsRequest requestData = new IndexPartGetRowsRequest(rowIds, keyPart, func);
// 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 sendGetUDFRequest.
private void sendGetUDFRequest(MatrixTransportClient matrixClient, int userRequestId, int matrixId, int partId, GetFunc func, PartitionGetParam partGetParam) {
// Request header
RequestHeader header = createRequestHeader(userRequestId, TransportMethod.GET_PSF, matrixId, partId);
// Request body
GetUDFRequest requestData = new GetUDFRequest(func.getClass().getName(), partGetParam);
// 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 UpdateUDFHandler method handle.
@Override
public void handle(FutureResult finalResult, UserRequest userRequest, ResponseCache responseCache) {
MapResponseCache cache = (MapResponseCache) responseCache;
// Check update result
Map<Request, Response> responses = cache.getResponses();
boolean success = true;
String detail = "";
for (Response response : responses.values()) {
success = success && (response.getResponseType() == ResponseType.SUCCESS);
if (!success) {
detail = response.getDetail();
break;
}
}
// Set the final result
if (success) {
finalResult.set(new VoidResult(com.tencent.angel.psagent.matrix.ResponseType.SUCCESS));
} else {
finalResult.set(new VoidResult(com.tencent.angel.psagent.matrix.ResponseType.FAILED, detail));
}
}
use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class MatrixTransportClient method addToGetQueueForServer.
private void addToGetQueueForServer(ParameterServerId serverId, Request request) {
request.setContext(new RequestContext());
request.getContext().setServerId(serverId);
LinkedBlockingQueue<Request> queue = getItemQueues.get(serverId);
if (queue == null) {
queue = new LinkedBlockingQueue<>();
getItemQueues.putIfAbsent(serverId, queue);
queue = getItemQueues.get(serverId);
}
queue.add(request);
}
use of com.tencent.angel.ps.server.data.request.Request in project angel by Tencent.
the class MatrixTransportClient method addToPutQueueForServer.
private void addToPutQueueForServer(ParameterServerId serverId, Request request) {
request.setContext(new RequestContext());
request.getContext().setServerId(serverId);
LinkedBlockingQueue<Request> queue = putItemQueues.get(serverId);
if (queue == null) {
queue = new LinkedBlockingQueue<>();
putItemQueues.putIfAbsent(serverId, queue);
queue = putItemQueues.get(serverId);
}
queue.add(request);
}
Aggregations