Search in sources :

Example 1 with GaiaConfig

use of com.alibaba.graphscope.gaia.config.GaiaConfig in project GraphScope by alibaba.

the class QueryTest method main.

public static void main(String[] args) {
    GaiaConfig config = new ExperimentalGaiaConfig("conf");
    GraphStoreService graphStore = new ExperimentalGraphStore(config);
    IdMaker queryIdMaker = new IncrementalQueryIdMaker();
    test_CR_1_1(config, graphStore, queryIdMaker);
    test_CR_1_2(config, graphStore, queryIdMaker);
    test_CR_2(config, graphStore, queryIdMaker);
    test_CR_3_1(config, graphStore, queryIdMaker);
    test_CR_3_2(config, graphStore, queryIdMaker);
    test_CR_5(config, graphStore, queryIdMaker);
    test_CR_6(config, graphStore, queryIdMaker);
    test_CR_7(config, graphStore, queryIdMaker);
    test_CR_8(config, graphStore, queryIdMaker);
    test_CR_9(config, graphStore, queryIdMaker);
    test_CR_11(config, graphStore, queryIdMaker);
    test_CR_12(config, graphStore, queryIdMaker);
}
Also used : IncrementalQueryIdMaker(com.alibaba.graphscope.gaia.idmaker.IncrementalQueryIdMaker) ExperimentalGraphStore(com.alibaba.graphscope.gaia.store.ExperimentalGraphStore) GraphStoreService(com.alibaba.graphscope.gaia.store.GraphStoreService) GaiaConfig(com.alibaba.graphscope.gaia.config.GaiaConfig) ExperimentalGaiaConfig(com.alibaba.graphscope.gaia.config.ExperimentalGaiaConfig) ExperimentalGaiaConfig(com.alibaba.graphscope.gaia.config.ExperimentalGaiaConfig) IdMaker(com.alibaba.graphscope.gaia.idmaker.IdMaker) TagIdMaker(com.alibaba.graphscope.gaia.idmaker.TagIdMaker) IncrementalQueryIdMaker(com.alibaba.graphscope.gaia.idmaker.IncrementalQueryIdMaker)

Example 2 with GaiaConfig

use of com.alibaba.graphscope.gaia.config.GaiaConfig in project GraphScope by alibaba.

the class GaiaGraphServer method start.

@Override
public void start(int port, ProcessorLoader processorLoader, boolean hasAuth) {
    logger.info(GremlinServer.getHeader());
    this.settings.port = instanceConfig.getGremlinServerPort();
    this.settings.host = "0.0.0.0";
    if (settings.gremlinPool == 0) {
        settings.gremlinPool = Runtime.getRuntime().availableProcessors();
    }
    this.server = new GremlinServer(settings);
    loadProcessor(gaiaConfig, broadcastProcessor, storeService);
    // bind g to traversal source
    Graph traversalGraph = TraversalSourceGraph.open(new BaseConfiguration());
    ServerGremlinExecutor serverGremlinExecutor = PlanUtils.getServerGremlinExecutor(this.server);
    serverGremlinExecutor.getGraphManager().putGraph("graph", traversalGraph);
    serverGremlinExecutor.getGraphManager().putTraversalSource("g", traversalGraph.traversal());
    Bindings globalBindings = PlanUtils.getGlobalBindings(server.getServerGremlinExecutor().getGremlinExecutor());
    globalBindings.put("graph", traversalGraph);
    globalBindings.put("g", traversalGraph.traversal());
    // start gremlin server
    try {
        server.start().exceptionally(t -> {
            logger.error("Gremlin Server was unable to start and will now begin" + " shutdown {}", t);
            server.stop().join();
            return null;
        }).join();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    logger.info("Gremlin Server started....");
}
Also used : ServerGremlinExecutor(org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor) OpProcessor(org.apache.tinkerpop.gremlin.server.OpProcessor) AbstractBroadcastProcessor(com.alibaba.graphscope.gaia.broadcast.AbstractBroadcastProcessor) SocketAddress(java.net.SocketAddress) Bindings(javax.script.Bindings) Settings(org.apache.tinkerpop.gremlin.server.Settings) Graph(org.apache.tinkerpop.gremlin.structure.Graph) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) TraversalOpProcessor(com.alibaba.graphscope.gaia.processor.TraversalOpProcessor) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) Map(java.util.Map) GraphStoreService(com.alibaba.graphscope.gaia.store.GraphStoreService) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) GaiaGraphOpProcessor(com.alibaba.graphscope.gaia.processor.GaiaGraphOpProcessor) ServerGremlinExecutor(org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor) Logger(org.slf4j.Logger) GaiaConfig(com.alibaba.graphscope.gaia.config.GaiaConfig) PlanUtils(com.alibaba.graphscope.gaia.plan.PlanUtils) InstanceConfig(com.alibaba.maxgraph.common.cluster.InstanceConfig) Field(java.lang.reflect.Field) InetSocketAddress(java.net.InetSocketAddress) Channel(io.netty.channel.Channel) ProcessorLoader(com.alibaba.maxgraph.server.ProcessorLoader) OpLoader(org.apache.tinkerpop.gremlin.server.op.OpLoader) LogicPlanProcessor(com.alibaba.graphscope.gaia.processor.LogicPlanProcessor) MaxGraphServer(com.alibaba.maxgraph.server.MaxGraphServer) GremlinExecutor(org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor) TraversalSourceGraph(com.alibaba.graphscope.gaia.TraversalSourceGraph) InputStream(java.io.InputStream) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) Graph(org.apache.tinkerpop.gremlin.structure.Graph) TraversalSourceGraph(com.alibaba.graphscope.gaia.TraversalSourceGraph) Bindings(javax.script.Bindings)

Example 3 with GaiaConfig

use of com.alibaba.graphscope.gaia.config.GaiaConfig in project GraphScope by alibaba.

the class GremlinServiceMain method main.

public static void main(String[] args) throws Exception {
    logger.info("start server");
    Settings settings = load();
    GremlinServer server = new GremlinServer(settings);
    // create graph
    GaiaConfig gaiaConfig = new ExperimentalGaiaConfig("conf");
    GraphStoreService storeService = new ExperimentalGraphStore(gaiaConfig);
    GaiaProcessorLoader.load(gaiaConfig, storeService);
    // set global variables
    Graph traversalGraph = server.getServerGremlinExecutor().getGraphManager().getGraph("graph");
    GlobalEngineConf.setGlobalVariables(traversalGraph.variables());
    // bind g to traversal source
    Bindings globalBindings = PlanUtils.getGlobalBindings(server.getServerGremlinExecutor().getGremlinExecutor());
    globalBindings.put("g", traversalGraph.traversal());
    // start gremlin server
    server.start().exceptionally(t -> {
        logger.error("Gremlin Server was unable to start and will now begin shutdown" + " {}", t);
        server.stop().join();
        return null;
    }).join();
}
Also used : Logger(org.slf4j.Logger) Bindings(javax.script.Bindings) GaiaConfig(com.alibaba.graphscope.gaia.config.GaiaConfig) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) ExperimentalGraphStore(com.alibaba.graphscope.gaia.store.ExperimentalGraphStore) Settings(org.apache.tinkerpop.gremlin.server.Settings) GaiaProcessorLoader(com.alibaba.graphscope.gaia.processor.GaiaProcessorLoader) Graph(org.apache.tinkerpop.gremlin.structure.Graph) PlanUtils(com.alibaba.graphscope.gaia.plan.PlanUtils) LoggerFactory(org.slf4j.LoggerFactory) ExperimentalGaiaConfig(com.alibaba.graphscope.gaia.config.ExperimentalGaiaConfig) GraphStoreService(com.alibaba.graphscope.gaia.store.GraphStoreService) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) Graph(org.apache.tinkerpop.gremlin.structure.Graph) ExperimentalGraphStore(com.alibaba.graphscope.gaia.store.ExperimentalGraphStore) GraphStoreService(com.alibaba.graphscope.gaia.store.GraphStoreService) GaiaConfig(com.alibaba.graphscope.gaia.config.GaiaConfig) ExperimentalGaiaConfig(com.alibaba.graphscope.gaia.config.ExperimentalGaiaConfig) Bindings(javax.script.Bindings) Settings(org.apache.tinkerpop.gremlin.server.Settings) ExperimentalGaiaConfig(com.alibaba.graphscope.gaia.config.ExperimentalGaiaConfig)

Example 4 with GaiaConfig

use of com.alibaba.graphscope.gaia.config.GaiaConfig in project GraphScope by alibaba.

the class GaiaGraphServer method start.

@Override
public void start() {
    this.loadSettings();
    logger.info(GremlinServer.getHeader());
    this.settings.port = GremlinConfig.GREMLIN_PORT.get(this.configs);
    this.settings.host = "0.0.0.0";
    if (settings.gremlinPool == 0) {
        settings.gremlinPool = Runtime.getRuntime().availableProcessors();
    }
    settings.writeBufferHighWaterMark = GremlinConfig.SERVER_WRITE_BUFFER_HIGH_WATER.get(this.configs);
    settings.writeBufferLowWaterMark = GremlinConfig.SERVER_WRITE_BUFFER_LOW_WATER.get(this.configs);
    this.server = new GremlinServer(settings);
    loadProcessor(gaiaConfig, broadcastProcessor, storeService);
    // bind g to traversal source
    Graph traversalGraph = TraversalSourceGraph.open(new BaseConfiguration());
    ServerGremlinExecutor serverGremlinExecutor = PlanUtils.getServerGremlinExecutor(this.server);
    serverGremlinExecutor.getGraphManager().putGraph("graph", traversalGraph);
    serverGremlinExecutor.getGraphManager().putTraversalSource("g", traversalGraph.traversal());
    Bindings globalBindings = PlanUtils.getGlobalBindings(server.getServerGremlinExecutor().getGremlinExecutor());
    globalBindings.put("graph", traversalGraph);
    globalBindings.put("g", traversalGraph.traversal());
    // start gremlin server
    try {
        server.start().exceptionally(t -> {
            logger.error("Gremlin Server was unable to start and will now begin" + " shutdown {}", t);
            server.stop().join();
            return null;
        }).join();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    logger.info("Gremlin Server started....");
}
Also used : ServerGremlinExecutor(org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor) Configs(com.alibaba.maxgraph.common.config.Configs) OpProcessor(org.apache.tinkerpop.gremlin.server.OpProcessor) AbstractBroadcastProcessor(com.alibaba.graphscope.gaia.broadcast.AbstractBroadcastProcessor) SocketAddress(java.net.SocketAddress) Bindings(javax.script.Bindings) Settings(org.apache.tinkerpop.gremlin.server.Settings) Graph(org.apache.tinkerpop.gremlin.structure.Graph) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) TraversalOpProcessor(com.alibaba.graphscope.gaia.processor.TraversalOpProcessor) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) Map(java.util.Map) GraphStoreService(com.alibaba.graphscope.gaia.store.GraphStoreService) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) GremlinConfig(com.alibaba.maxgraph.common.config.GremlinConfig) GaiaGraphOpProcessor(com.alibaba.graphscope.gaia.processor.GaiaGraphOpProcessor) ServerGremlinExecutor(org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor) Logger(org.slf4j.Logger) GaiaConfig(com.alibaba.graphscope.gaia.config.GaiaConfig) AbstractService(com.alibaba.maxgraph.servers.AbstractService) PlanUtils(com.alibaba.graphscope.gaia.plan.PlanUtils) Field(java.lang.reflect.Field) InetSocketAddress(java.net.InetSocketAddress) Channel(io.netty.channel.Channel) OpLoader(org.apache.tinkerpop.gremlin.server.op.OpLoader) LogicPlanProcessor(com.alibaba.graphscope.gaia.processor.LogicPlanProcessor) TraversalSourceGraph(com.alibaba.graphscope.gaia.TraversalSourceGraph) InputStream(java.io.InputStream) GremlinServer(org.apache.tinkerpop.gremlin.server.GremlinServer) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) Graph(org.apache.tinkerpop.gremlin.structure.Graph) TraversalSourceGraph(com.alibaba.graphscope.gaia.TraversalSourceGraph) Bindings(javax.script.Bindings)

Aggregations

GaiaConfig (com.alibaba.graphscope.gaia.config.GaiaConfig)4 GraphStoreService (com.alibaba.graphscope.gaia.store.GraphStoreService)4 PlanUtils (com.alibaba.graphscope.gaia.plan.PlanUtils)3 Bindings (javax.script.Bindings)3 GremlinServer (org.apache.tinkerpop.gremlin.server.GremlinServer)3 Settings (org.apache.tinkerpop.gremlin.server.Settings)3 Graph (org.apache.tinkerpop.gremlin.structure.Graph)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 TraversalSourceGraph (com.alibaba.graphscope.gaia.TraversalSourceGraph)2 AbstractBroadcastProcessor (com.alibaba.graphscope.gaia.broadcast.AbstractBroadcastProcessor)2 ExperimentalGaiaConfig (com.alibaba.graphscope.gaia.config.ExperimentalGaiaConfig)2 GaiaGraphOpProcessor (com.alibaba.graphscope.gaia.processor.GaiaGraphOpProcessor)2 LogicPlanProcessor (com.alibaba.graphscope.gaia.processor.LogicPlanProcessor)2 TraversalOpProcessor (com.alibaba.graphscope.gaia.processor.TraversalOpProcessor)2 ExperimentalGraphStore (com.alibaba.graphscope.gaia.store.ExperimentalGraphStore)2 Channel (io.netty.channel.Channel)2 InputStream (java.io.InputStream)2 Field (java.lang.reflect.Field)2 InetSocketAddress (java.net.InetSocketAddress)2