Search in sources :

Example 6 with MaxGraphException

use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.

the class MaxNode method start.

public void start() {
    List<Thread> startThreads = new ArrayList<>();
    for (NodeBase store : this.stores) {
        startThreads.add(new Thread(() -> {
            store.start();
            logger.info("[" + store.getName() + "] started");
        }));
    }
    for (NodeBase frontend : this.frontends) {
        startThreads.add(new Thread(() -> {
            frontend.start();
            logger.info("[" + frontend.getName() + "] started");
        }));
    }
    for (NodeBase ingestor : this.ingestors) {
        startThreads.add(new Thread(() -> {
            ingestor.start();
            logger.info("[" + ingestor.getName() + "] started");
        }));
    }
    startThreads.add(new Thread(() -> {
        this.coordinator.start();
        logger.info("[" + this.coordinator.getName() + "] started");
    }));
    for (Thread startThread : startThreads) {
        startThread.start();
    }
    for (Thread startThread : startThreads) {
        try {
            startThread.join();
        } catch (InterruptedException e) {
            throw new MaxGraphException(e);
        }
    }
    logger.info("maxnode started");
}
Also used : ArrayList(java.util.ArrayList) MaxGraphException(com.alibaba.maxgraph.compiler.api.exception.MaxGraphException)

Example 7 with MaxGraphException

use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.

the class Store method start.

@Override
public void start() {
    this.metaService.start();
    try {
        this.storeService.start();
    } catch (IOException e) {
        throw new MaxGraphException(e);
    }
    long availSnapshotId;
    try {
        availSnapshotId = this.storeService.recover();
    } catch (IOException | InterruptedException e) {
        throw new MaxGraphException(e);
    }
    this.writerAgent.init(availSnapshotId);
    this.writerAgent.start();
    this.backupAgent.start();
    try {
        this.rpcServer.start();
    } catch (IOException e) {
        throw new MaxGraphException(e);
    }
    this.discovery.start();
    this.channelManager.start();
    this.executorService.start();
}
Also used : IOException(java.io.IOException) MaxGraphException(com.alibaba.maxgraph.compiler.api.exception.MaxGraphException)

Example 8 with MaxGraphException

use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.

the class GaiaEngine method start.

@Override
public void start() {
    try (GaiaPortsResponse gaiaPortsResponse = GaiaLibrary.INSTANCE.startEngine(this.pointer)) {
        if (!gaiaPortsResponse.success) {
            throw new MaxGraphException(gaiaPortsResponse.errMsg);
        }
        engineNodeProvider.apply(gaiaPortsResponse.enginePort);
        rpcNodeProvider.apply(gaiaPortsResponse.rpcPort);
    }
    this.engineDiscovery.start();
    this.engineDiscovery.addListener(this);
    this.rpcDiscovery.start();
}
Also used : GaiaPortsResponse(com.alibaba.maxgraph.servers.jna.GaiaPortsResponse) MaxGraphException(com.alibaba.maxgraph.compiler.api.exception.MaxGraphException)

Example 9 with MaxGraphException

use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.

the class GraphWriter method writeBatch.

public long writeBatch(String requestId, String writeSession, List<WriteRequest> writeRequests) {
    CompletableFuture<Long> future = new CompletableFuture<>();
    writeBatch(requestId, writeSession, writeRequests, new CompletionCallback<Long>() {

        @Override
        public void onCompleted(Long res) {
            future.complete(res);
        }

        @Override
        public void onError(Throwable t) {
            future.completeExceptionally(t);
        }
    });
    try {
        return future.get();
    } catch (InterruptedException | ExecutionException e) {
        throw new MaxGraphException(e);
    }
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) AtomicLong(java.util.concurrent.atomic.AtomicLong) ExecutionException(java.util.concurrent.ExecutionException) MaxGraphException(com.alibaba.maxgraph.compiler.api.exception.MaxGraphException)

Example 10 with MaxGraphException

use of com.alibaba.maxgraph.compiler.api.exception.MaxGraphException in project GraphScope by alibaba.

the class MaxTestGraphProvider method loadGraphData.

@Override
public void loadGraphData(Graph graph, LoadGraphWith loadGraphWith, Class testClass, String testName) {
    try {
        ((MaxTestGraph) graph).loadSchema(null == loadGraphWith ? LoadGraphWith.GraphData.CLASSIC : loadGraphWith.value());
    } catch (URISyntaxException | IOException e) {
        logger.error("load schema failed", e);
        throw new MaxGraphException(e);
    }
    super.loadGraphData(graph, loadGraphWith, testClass, testName);
    logger.info("vertex value map list: " + graph.traversal().V().valueMap().toList());
    logger.info("edge value map list: " + graph.traversal().E().valueMap().toList());
}
Also used : URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) MaxGraphException(com.alibaba.maxgraph.compiler.api.exception.MaxGraphException)

Aggregations

MaxGraphException (com.alibaba.maxgraph.compiler.api.exception.MaxGraphException)24 IOException (java.io.IOException)14 URISyntaxException (java.net.URISyntaxException)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 ExecutionException (java.util.concurrent.ExecutionException)3 RoleType (com.alibaba.maxgraph.common.RoleType)2 Configs (com.alibaba.maxgraph.common.config.Configs)2 GaiaPortsResponse (com.alibaba.maxgraph.servers.jna.GaiaPortsResponse)2 FileNotFoundException (java.io.FileNotFoundException)2 HashMap (java.util.HashMap)2 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 GremlinConfig (com.alibaba.maxgraph.common.config.GremlinConfig)1 RpcAddressFetcher (com.alibaba.maxgraph.common.rpc.RpcAddressFetcher)1 BackupException (com.alibaba.maxgraph.compiler.api.exception.BackupException)1 GraphSchema (com.alibaba.maxgraph.compiler.api.schema.GraphSchema)1 SchemaFetcher (com.alibaba.maxgraph.compiler.api.schema.SchemaFetcher)1 DropSchemaResponse (com.alibaba.maxgraph.proto.groot.DropSchemaResponse)1 LoadJsonSchemaResponse (com.alibaba.maxgraph.proto.groot.LoadJsonSchemaResponse)1 MaxGraphWsAndHttpSocketChannelizer (com.alibaba.maxgraph.server.MaxGraphWsAndHttpSocketChannelizer)1