Search in sources :

Example 1 with ExecutorDiscoveryManager

use of com.alibaba.maxgraph.servers.maxgraph.ExecutorDiscoveryManager in project GraphScope by alibaba.

the class ExecutorDiscoveryManagerTest method testExecutorServerStart.

@Test
void testExecutorServerStart() throws Exception {
    try (TestingServer testingServer = new TestingServer(-1)) {
        int zkPort = testingServer.getPort();
        Configs configs = Configs.newBuilder().put(ZkConfig.ZK_CONNECT_STRING.getKey(), "localhost:" + zkPort).put(ZkConfig.ZK_BASE_PATH.getKey(), "test_discovery").build();
        CuratorFramework curator = CuratorUtils.makeCurator(configs);
        curator.start();
        LocalNodeProvider engineServerProvider = new LocalNodeProvider(RoleType.EXECUTOR_ENGINE, configs);
        NodeDiscovery engineServerDiscovery = new ZkDiscovery(configs, engineServerProvider, curator);
        LocalNodeProvider storeQueryProvider = new LocalNodeProvider(RoleType.EXECUTOR_GRAPH, configs);
        NodeDiscovery storeQueryDiscovery = new ZkDiscovery(configs, storeQueryProvider, curator);
        LocalNodeProvider queryExecuteProvider = new LocalNodeProvider(RoleType.EXECUTOR_QUERY, configs);
        NodeDiscovery queryExecuteDiscovery = new ZkDiscovery(configs, queryExecuteProvider, curator);
        LocalNodeProvider queryManageProvider = new LocalNodeProvider(RoleType.EXECUTOR_MANAGE, configs);
        NodeDiscovery queryManageDiscovery = new ZkDiscovery(configs, queryManageProvider, curator);
        ExecutorDiscoveryManager executorDiscoveryManager = new ExecutorDiscoveryManager(engineServerProvider, engineServerDiscovery, storeQueryProvider, storeQueryDiscovery, queryExecuteProvider, queryExecuteDiscovery, queryManageProvider, queryManageDiscovery);
        executorDiscoveryManager.getEngineServerProvider().apply(123);
        executorDiscoveryManager.getEngineServerDiscovery().start();
        executorDiscoveryManager.getQueryExecuteProvider().apply(1234);
        executorDiscoveryManager.getQueryExecuteDiscovery().start();
    }
}
Also used : TestingServer(org.apache.curator.test.TestingServer) LocalNodeProvider(com.alibaba.graphscope.groot.discovery.LocalNodeProvider) CuratorFramework(org.apache.curator.framework.CuratorFramework) NodeDiscovery(com.alibaba.graphscope.groot.discovery.NodeDiscovery) ExecutorDiscoveryManager(com.alibaba.maxgraph.servers.maxgraph.ExecutorDiscoveryManager) Configs(com.alibaba.maxgraph.common.config.Configs) ZkDiscovery(com.alibaba.graphscope.groot.discovery.ZkDiscovery) Test(org.junit.jupiter.api.Test)

Aggregations

LocalNodeProvider (com.alibaba.graphscope.groot.discovery.LocalNodeProvider)1 NodeDiscovery (com.alibaba.graphscope.groot.discovery.NodeDiscovery)1 ZkDiscovery (com.alibaba.graphscope.groot.discovery.ZkDiscovery)1 Configs (com.alibaba.maxgraph.common.config.Configs)1 ExecutorDiscoveryManager (com.alibaba.maxgraph.servers.maxgraph.ExecutorDiscoveryManager)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 TestingServer (org.apache.curator.test.TestingServer)1 Test (org.junit.jupiter.api.Test)1