Search in sources :

Example 1 with WorkerErrorResponse

use of com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.WorkerErrorResponse in project angel by Tencent.

the class MasterService method workerError.

/**
 * worker run failed
 *
 * @param controller rpc controller of protobuf
 * @param request contains worker attempt id, error message
 */
@SuppressWarnings("unchecked")
@Override
public WorkerErrorResponse workerError(RpcController controller, WorkerErrorRequest request) throws ServiceException {
    WorkerAttemptId workerAttemptId = ProtobufUtil.convertToId(request.getWorkerAttemptId());
    LOG.info("worker attempt " + workerAttemptId + " failed, details=" + request.getMsg());
    WorkerErrorResponse.Builder resBuilder = WorkerErrorResponse.newBuilder();
    // if worker attempt id is not in monitor set, we should shutdown it
    if (!context.getWorkerManager().isAlive(workerAttemptId)) {
        resBuilder.setCommand(WorkerCommandProto.W_SHUTDOWN);
    } else {
        context.getWorkerManager().unRegister(workerAttemptId);
        context.getEventHandler().handle(new WorkerAttemptDiagnosticsUpdateEvent(workerAttemptId, request.getMsg()));
        context.getEventHandler().handle(new WorkerAttemptEvent(WorkerAttemptEventType.ERROR, workerAttemptId));
        resBuilder.setCommand(WorkerCommandProto.W_SUCCESS);
    }
    return resBuilder.build();
}
Also used : WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) WorkerAttemptDiagnosticsUpdateEvent(com.tencent.angel.master.worker.attempt.WorkerAttemptDiagnosticsUpdateEvent) WorkerAttemptEvent(com.tencent.angel.master.worker.attempt.WorkerAttemptEvent) WorkerErrorResponse(com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.WorkerErrorResponse)

Aggregations

WorkerAttemptDiagnosticsUpdateEvent (com.tencent.angel.master.worker.attempt.WorkerAttemptDiagnosticsUpdateEvent)1 WorkerAttemptEvent (com.tencent.angel.master.worker.attempt.WorkerAttemptEvent)1 WorkerErrorResponse (com.tencent.angel.protobuf.generated.WorkerMasterServiceProtos.WorkerErrorResponse)1 WorkerAttemptId (com.tencent.angel.worker.WorkerAttemptId)1