use of com.tencent.angel.master.ps.attempt.PSAttemptEvent in project angel by Tencent.
the class LocalContainerLauncher method launch.
@SuppressWarnings("unchecked")
private void launch(ContainerLauncherEvent event) {
Id id = event.getId();
if (id instanceof PSAttemptId) {
LocalPS ps = new LocalPS((PSAttemptId) id, context.getMasterService().getLocation(), context.getConf());
context.getEventHandler().handle(new PSAttemptEvent(PSAttemptEventType.PA_CONTAINER_LAUNCHED, (PSAttemptId) id));
try {
ps.start();
LocalClusterContext.get().addPS((PSAttemptId) id, ps);
} catch (Exception e) {
LOG.error("launch ps failed.", e);
context.getEventHandler().handle(new PSAttemptEvent(PSAttemptEventType.PA_CONTAINER_LAUNCH_FAILED, (PSAttemptId) id));
}
} else if (id instanceof PSAgentAttemptId) {
context.getEventHandler().handle(new PSAgentAttemptEvent(PSAgentAttemptEventType.PSAGENT_ATTEMPT_CONTAINER_LAUNCHED, (PSAgentAttemptId) id));
} else if (id instanceof WorkerAttemptId) {
LocalWorker worker = new LocalWorker(context.getConf(), context.getApplicationId(), context.getUser(), (WorkerAttemptId) id, context.getMasterService().getLocation(), 0, false);
context.getEventHandler().handle(new WorkerAttemptEvent(WorkerAttemptEventType.CONTAINER_LAUNCHED, (WorkerAttemptId) id));
try {
worker.start();
LocalClusterContext.get().addWorker((WorkerAttemptId) id, worker);
} catch (Exception e) {
LOG.error("launch worker failed.", e);
context.getEventHandler().handle(new WorkerAttemptEvent(WorkerAttemptEventType.CONTAINER_LAUNCH_FAILED, (WorkerAttemptId) id));
}
}
}
use of com.tencent.angel.master.ps.attempt.PSAttemptEvent in project angel by Tencent.
the class AMParameterServer method addAndScheduleAttempt.
@SuppressWarnings("unchecked")
private void addAndScheduleAttempt() {
PSAttempt attempt = null;
writeLock.lock();
try {
attempt = createPSAttempt();
attempts.put(attempt.getId(), attempt);
LOG.info("scheduling " + attempt.getId());
runningPSAttemptId = attempt.getId();
} finally {
writeLock.unlock();
}
// getContext().getLocationManager().setPsLocation(id, null);
getContext().getEventHandler().handle(new PSAttemptEvent(PSAttemptEventType.PA_SCHEDULE, attempt.getId()));
}
Aggregations