Search in sources :

Example 1 with PSAttemptDiagnosticsUpdateEvent

use of com.tencent.angel.master.ps.attempt.PSAttemptDiagnosticsUpdateEvent in project angel by Tencent.

the class YarnContainerAllocator method handleFinishContainers.

@SuppressWarnings("unchecked")
private void handleFinishContainers(List<ContainerStatus> finishedContainers) {
    for (ContainerStatus cont : finishedContainers) {
        LOG.info("Received completed container:" + cont);
        Id id = assignedContainerToIDMap.get(cont.getContainerId());
        if (id == null) {
            LOG.error("Container complete event for unknown container id " + cont.getContainerId());
        } else {
            assignedContainerToIDMap.remove(cont.getContainerId());
            idToContainerMap.remove(id);
            // dispatch container exit message to corresponding components
            String diagnostics = StringInterner.weakIntern(cont.getDiagnostics());
            if (id instanceof PSAttemptId) {
                context.getEventHandler().handle(new PSAttemptDiagnosticsUpdateEvent(diagnostics, (PSAttemptId) id));
                context.getEventHandler().handle(createContainerFinishedEvent(cont, (PSAttemptId) id));
            } else if (id instanceof PSAgentAttemptId) {
                context.getEventHandler().handle(new PSAgentAttemptDiagnosticsUpdateEvent((PSAgentAttemptId) id, diagnostics));
                context.getEventHandler().handle(createContainerFinishedEvent(cont, (PSAgentAttemptId) id));
            } else if (id instanceof WorkerAttemptId) {
                context.getEventHandler().handle(new WorkerAttemptDiagnosticsUpdateEvent((WorkerAttemptId) id, diagnostics));
                context.getEventHandler().handle(createContainerFinishedEvent(cont, (WorkerAttemptId) id));
            }
        }
    }
}
Also used : PSAttemptId(com.tencent.angel.ps.PSAttemptId) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) WorkerAttemptDiagnosticsUpdateEvent(com.tencent.angel.master.worker.attempt.WorkerAttemptDiagnosticsUpdateEvent) PSAttemptDiagnosticsUpdateEvent(com.tencent.angel.master.ps.attempt.PSAttemptDiagnosticsUpdateEvent) PSAgentAttemptId(com.tencent.angel.psagent.PSAgentAttemptId) PSAgentAttemptId(com.tencent.angel.psagent.PSAgentAttemptId) PSAttemptId(com.tencent.angel.ps.PSAttemptId) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) Id(com.tencent.angel.common.Id) PSAgentAttemptDiagnosticsUpdateEvent(com.tencent.angel.master.psagent.PSAgentAttemptDiagnosticsUpdateEvent)

Aggregations

Id (com.tencent.angel.common.Id)1 PSAttemptDiagnosticsUpdateEvent (com.tencent.angel.master.ps.attempt.PSAttemptDiagnosticsUpdateEvent)1 PSAgentAttemptDiagnosticsUpdateEvent (com.tencent.angel.master.psagent.PSAgentAttemptDiagnosticsUpdateEvent)1 WorkerAttemptDiagnosticsUpdateEvent (com.tencent.angel.master.worker.attempt.WorkerAttemptDiagnosticsUpdateEvent)1 PSAttemptId (com.tencent.angel.ps.PSAttemptId)1 PSAgentAttemptId (com.tencent.angel.psagent.PSAgentAttemptId)1 WorkerAttemptId (com.tencent.angel.worker.WorkerAttemptId)1