Search in sources :

Example 1 with WorkerAttemptContainerAssignedEvent

use of com.tencent.angel.master.worker.attempt.WorkerAttemptContainerAssignedEvent in project angel by Tencent.

the class LocalContainerAllocator method requestContainer.

@SuppressWarnings("unchecked")
private void requestContainer(ContainerAllocatorEvent event) {
    LocalContainer allocated = new LocalContainer();
    Id id = event.getTaskId();
    if (id instanceof PSAttemptId) {
        context.getEventHandler().handle(new PSAttemptContainerAssignedEvent((PSAttemptId) id, allocated));
    } else if (id instanceof PSAgentAttemptId) {
        context.getEventHandler().handle(new PSAgentAttemptContainerAssignedEvent((PSAgentAttemptId) id, allocated));
    } else if (id instanceof WorkerAttemptId) {
        context.getEventHandler().handle(new WorkerAttemptContainerAssignedEvent((WorkerAttemptId) id, allocated));
    }
}
Also used : PSAttemptContainerAssignedEvent(com.tencent.angel.master.ps.attempt.PSAttemptContainerAssignedEvent) PSAttemptId(com.tencent.angel.ps.PSAttemptId) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) PSAgentAttemptContainerAssignedEvent(com.tencent.angel.master.psagent.PSAgentAttemptContainerAssignedEvent) PSAgentAttemptId(com.tencent.angel.psagent.PSAgentAttemptId) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) Id(com.tencent.angel.common.Id) PSAgentAttemptId(com.tencent.angel.psagent.PSAgentAttemptId) PSAttemptId(com.tencent.angel.ps.PSAttemptId) WorkerAttemptContainerAssignedEvent(com.tencent.angel.master.worker.attempt.WorkerAttemptContainerAssignedEvent)

Example 2 with WorkerAttemptContainerAssignedEvent

use of com.tencent.angel.master.worker.attempt.WorkerAttemptContainerAssignedEvent in project angel by Tencent.

the class YarnContainerAllocator method containerAssigned.

@SuppressWarnings("unchecked")
private void containerAssigned(Container allocated, ContainerRequest assigned) {
    // Update resource requests
    decContainerReq(assigned);
    // send the container-assigned event to task attempt
    if (assigned.id instanceof PSAttemptId) {
        context.getEventHandler().handle(new PSAttemptContainerAssignedEvent((PSAttemptId) assigned.id, allocated));
    } else if (assigned.id instanceof PSAgentAttemptId) {
        context.getEventHandler().handle(new PSAgentAttemptContainerAssignedEvent((PSAgentAttemptId) assigned.id, allocated));
    } else if (assigned.id instanceof WorkerAttemptId) {
        context.getEventHandler().handle(new WorkerAttemptContainerAssignedEvent((WorkerAttemptId) assigned.id, allocated));
    }
    assignedContainerToIDMap.put(allocated.getId(), assigned.id);
    idToContainerMap.put(assigned.id, allocated);
    LOG.info("Assigned container (" + allocated + ") " + " to task " + assigned.id + " on node " + allocated.getNodeId().toString());
}
Also used : PSAttemptContainerAssignedEvent(com.tencent.angel.master.ps.attempt.PSAttemptContainerAssignedEvent) PSAttemptId(com.tencent.angel.ps.PSAttemptId) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) PSAgentAttemptContainerAssignedEvent(com.tencent.angel.master.psagent.PSAgentAttemptContainerAssignedEvent) PSAgentAttemptId(com.tencent.angel.psagent.PSAgentAttemptId) WorkerAttemptContainerAssignedEvent(com.tencent.angel.master.worker.attempt.WorkerAttemptContainerAssignedEvent)

Aggregations

PSAttemptContainerAssignedEvent (com.tencent.angel.master.ps.attempt.PSAttemptContainerAssignedEvent)2 PSAgentAttemptContainerAssignedEvent (com.tencent.angel.master.psagent.PSAgentAttemptContainerAssignedEvent)2 WorkerAttemptContainerAssignedEvent (com.tencent.angel.master.worker.attempt.WorkerAttemptContainerAssignedEvent)2 PSAttemptId (com.tencent.angel.ps.PSAttemptId)2 PSAgentAttemptId (com.tencent.angel.psagent.PSAgentAttemptId)2 WorkerAttemptId (com.tencent.angel.worker.WorkerAttemptId)2 Id (com.tencent.angel.common.Id)1