use of com.tencent.angel.psagent.PSAgent in project angel by Tencent.
the class WorkerTest method testPsAgent.
@Test
public void testPsAgent() throws Exception {
try {
localWorker = LocalClusterContext.get().getWorker(worker0Attempt0Id);
worker = localWorker.getWorker();
// test psAgent
PSAgent psAgent = worker.getPSAgent();
assertTrue(psAgent != null);
PSAgentAttemptId psAgentAttemptId = psAgent.getId();
Assert.assertEquals(psAgentAttemptId.toString(), "PSAgentAttempt_0_0");
assertEquals(psAgent.getMasterLocation(), worker.getMasterLocation());
} catch (Exception x) {
LOG.error("run testPsAgent failed ", x);
throw x;
}
}
use of com.tencent.angel.psagent.PSAgent in project angel by Tencent.
the class Worker method initAndStart.
/**
* Init and start Worker's components,run tasks through by {@link TaskManager}
*
* @throws Exception the exception
*/
public void initAndStart() throws Exception {
LOG.info("Init and start worker");
psAgent = new PSAgent(conf, masterLocation.getIp(), masterLocation.getPort(), workerAttemptId.getWorkerId().getIndex(), false, this);
dataBlockManager = new DataBlockManager();
taskManager = new TaskManager();
LOG.info("Init and start psagent for worker");
psAgent.initAndStart();
LOG.info("Init data block manager");
dataBlockManager.init();
LOG.info("Init and start worker rpc server");
workerService = new WorkerService();
workerService.start();
LOG.info("Init counter updater");
counterUpdater.initialize();
// init task manager and start tasks
masterClient = psAgent.getMasterClient();
// start heartbeat thread
LOG.info("Register to master and start the heartbeat thread");
startHeartbeatThread();
LOG.info("Get data splits from master");
workerGroup = masterClient.getWorkerGroupMetaInfo();
dataBlockManager.setSplitClassification(workerGroup.getSplits());
LOG.info("Init and start task manager and all task");
taskManager.init();
taskManager.startAllTasks(workerGroup.getWorkerRef(workerAttemptId.getWorkerId()).getTaskIdToContextMap());
workerInitFinishedFlag.set(true);
}
Aggregations