use of com.baidu.hugegraph.computer.core.network.connection.TransportConnectionManager in project hugegraph-computer by hugegraph.
the class WorkerService method initManagers.
private InetSocketAddress initManagers(ContainerInfo masterInfo) {
// Create managers
WorkerRpcManager rpcManager = new WorkerRpcManager();
this.managers.add(rpcManager);
/*
* NOTE: this init() method will be called twice, will be ignored at
* the 2nd time call.
*/
WorkerRpcManager.updateRpcRemoteServerConfig(this.config, masterInfo.hostname(), masterInfo.rpcPort());
rpcManager.init(this.config);
WorkerAggrManager aggregatorManager = new WorkerAggrManager(this.context);
aggregatorManager.service(rpcManager.aggregateRpcService());
this.managers.add(aggregatorManager);
FileManager fileManager = new FileManager();
this.managers.add(fileManager);
SortManager recvSortManager = new RecvSortManager(this.context);
this.managers.add(recvSortManager);
MessageRecvManager recvManager = new MessageRecvManager(this.context, fileManager, recvSortManager);
this.managers.add(recvManager);
ConnectionManager connManager = new TransportConnectionManager();
DataServerManager serverManager = new DataServerManager(connManager, recvManager);
this.managers.add(serverManager);
DataClientManager clientManager = new DataClientManager(connManager, this.context);
this.managers.add(clientManager);
SortManager sendSortManager = new SendSortManager(this.context);
this.managers.add(sendSortManager);
MessageSendManager sendManager = new MessageSendManager(this.context, sendSortManager, clientManager.sender());
this.managers.add(sendManager);
WorkerInputManager inputManager = new WorkerInputManager(this.context, sendManager);
inputManager.service(rpcManager.inputSplitService());
this.managers.add(inputManager);
// Init all managers
this.managers.initAll(this.config);
InetSocketAddress address = serverManager.address();
LOG.info("{} WorkerService initialized managers with data server " + "address '{}'", this, address);
return address;
}
use of com.baidu.hugegraph.computer.core.network.connection.TransportConnectionManager in project hugegraph-computer by hugegraph.
the class DataServerManagerTest method test.
@Test
public void test() {
Config config = UnitTestBase.updateWithRequiredOptions(RpcOptions.RPC_REMOTE_URL, "127.0.0.1:8090", ComputerOptions.JOB_ID, "local_001", ComputerOptions.JOB_WORKERS_COUNT, "1", ComputerOptions.BSP_LOG_INTERVAL, "30000", ComputerOptions.BSP_MAX_SUPER_STEP, "2", ComputerOptions.WORKER_COMPUTATION_CLASS, MockComputation.class.getName(), ComputerOptions.MASTER_COMPUTATION_CLASS, MockMasterComputation.class.getName());
FileManager fileManager = new FileManager();
fileManager.init(config);
SortManager sortManager = new RecvSortManager(context());
sortManager.init(config);
MessageRecvManager recvManager = new MessageRecvManager(context(), fileManager, sortManager);
recvManager.init(config);
ConnectionManager connManager = new TransportConnectionManager();
DataServerManager serverManager = new DataServerManager(connManager, recvManager);
serverManager.init(config);
Assert.assertEquals(DataServerManager.NAME, serverManager.name());
InetSocketAddress address = serverManager.address();
Assert.assertNotEquals(0, address.getPort());
ConnectionId connectionId = ConnectionId.parseConnectionId(address.getHostName(), address.getPort());
recvManager.onChannelActive(connectionId);
recvManager.onChannelInactive(connectionId);
TransportException e = new TransportException("test transport " + "exception");
recvManager.exceptionCaught(e, connectionId);
serverManager.close(config);
fileManager.close(config);
sortManager.close(config);
}
use of com.baidu.hugegraph.computer.core.network.connection.TransportConnectionManager in project hugegraph-computer by hugegraph.
the class AbstractNetworkTest method setup.
@Before
public void setup() {
Configurator.setAllLevels("com.baidu.hugegraph", Level.DEBUG);
OPTIONS.put(ComputerOptions.TRANSPORT_SERVER_HOST, host);
OPTIONS.put(ComputerOptions.TRANSPORT_IO_MODE, "AUTO");
OPTIONS.put(ComputerOptions.TRANSPORT_SERVER_PORT, "0");
this.initOption();
Object[] objects = new Object[OPTIONS.size() * 2];
Set<Map.Entry<ConfigOption<?>, String>> kvs = OPTIONS.entrySet();
int i = 0;
for (Map.Entry<ConfigOption<?>, String> kv : kvs) {
objects[i++] = kv.getKey();
objects[i++] = kv.getValue();
}
config = UnitTestBase.updateWithRequiredOptions(objects);
conf = TransportConf.wrapConfig(config);
serverHandler = Mockito.spy(new MockMessageHandler());
clientHandler = Mockito.spy(new MockClientHandler());
connectionManager = new TransportConnectionManager();
port = connectionManager.startServer(config, serverHandler);
connectionManager.initClientManager(config, clientHandler);
this.mockSpyProtocol();
}
Aggregations