use of com.alibaba.maxgraph.compiler.api.schema.SchemaFetcher in project GraphScope by alibaba.
the class Frontend method initAndStartGremlinServer.
@Override
protected void initAndStartGremlinServer() throws Exception {
SchemaFetcher schemaFetcher;
String vineyardSchemaPath = this.instanceConfig.getVineyardSchemaPath();
logger.info("Read schema from vineyard schema file " + vineyardSchemaPath);
schemaFetcher = new JsonFileSchemaFetcher(vineyardSchemaPath);
this.remoteGraph = new RemoteGraph(this, schemaFetcher);
this.remoteGraph.refresh();
this.graph = new TinkerMaxGraph(instanceConfig, remoteGraph, new DefaultGraphDfs());
// add gaia compiler
AsyncRpcChannelFetcher gaiaRpcFetcher = new AddressChannelFetcher(new ExecutorAddressFetcher(this.clientManager));
GraphStoreService gaiaStoreService = new VineyardGraphStore(schemaFetcher);
AbstractBroadcastProcessor broadcastProcessor = new AsyncRpcBroadcastProcessor(gaiaRpcFetcher);
gaiaGraphServer = new GaiaGraphServer(this.graph, instanceConfig, gaiaStoreService, broadcastProcessor, new VineyardConfig(instanceConfig));
gaiaGraphServer.start(0, null, false);
this.gremlinServerPort = gaiaGraphServer.getGremlinServerPort();
}
use of com.alibaba.maxgraph.compiler.api.schema.SchemaFetcher in project GraphScope by alibaba.
the class Frontend method initAndStartGremlinServer.
protected void initAndStartGremlinServer() throws Exception {
SchemaFetcher schemaFetcher;
String vineyardSchemaPath = this.instanceConfig.getVineyardSchemaPath();
LOG.info("Read schema from vineyard schema file " + vineyardSchemaPath);
schemaFetcher = new JsonFileSchemaFetcher(vineyardSchemaPath);
this.remoteGraph = new RemoteGraph(this, schemaFetcher);
this.remoteGraph.refresh();
this.graph = new TinkerMaxGraph(instanceConfig, remoteGraph, new DefaultGraphDfs());
this.graphGremlinServer = new MaxGraphServer(this.graph);
int tmpGremlinServerPort = instanceConfig.getGremlinServerPort() > 0 ? instanceConfig.getGremlinServerPort() : 0;
ProcessorLoader processorLoader;
switch(instanceConfig.getGremlinServerMode()) {
case TIMELY:
case MIXED:
{
processorLoader = MixedProcessorLoader.newProcessorLoader(graph, this.instanceConfig, new ExecutorAddressFetcher(clientManager), schemaFetcher, new ZKStatementStore(instanceConfig), new MaxGraphRecordProcessorManager(this.graph, this), this.getFrontendQueryManager());
break;
}
default:
{
processorLoader = GremlinProcessorLoader.newProcessorLoader();
break;
}
}
this.graphGremlinServer.start(tmpGremlinServerPort, processorLoader, instanceConfig.getInstanceAuthType() == 1);
this.gremlinServerPort = tmpGremlinServerPort > 0 ? tmpGremlinServerPort : this.graphGremlinServer.getGremlinServerPort();
LOG.info("gremlin server port:{}", this.gremlinServerPort);
}
use of com.alibaba.maxgraph.compiler.api.schema.SchemaFetcher in project GraphScope by alibaba.
the class Frontend method initAndStartGremlinServer.
@Override
protected void initAndStartGremlinServer() throws Exception {
SchemaFetcher schemaFetcher;
String vineyardSchemaPath = this.instanceConfig.getVineyardSchemaPath();
logger.info("Read schema from vineyard schema file " + vineyardSchemaPath);
schemaFetcher = new JsonFileSchemaFetcher(vineyardSchemaPath);
this.remoteGraph = new RemoteGraph(this, schemaFetcher);
this.remoteGraph.refresh();
this.graph = new TinkerMaxGraph(instanceConfig, remoteGraph, new DefaultGraphDfs());
// add ir compiler
Configs configs = getConfigs(this.instanceConfig);
IrMetaFetcher irMetaFetcher = getStoreConfigs(this.instanceConfig);
RpcAddressFetcher addressFetcher = new ExecutorAddressFetcher(this.clientManager);
RpcChannelFetcher channelFetcher = new RpcAddressChannelFetcher(addressFetcher);
this.gremlinServer = new IrGremlinServer(this.instanceConfig.getGremlinServerPort());
this.gremlinServer.start(configs, irMetaFetcher, channelFetcher, new IrMetaQueryCallback(irMetaFetcher), TestGraphFactory.VINEYARD);
this.gremlinServerPort = gremlinServer.getGremlinServerPort();
}
use of com.alibaba.maxgraph.compiler.api.schema.SchemaFetcher in project GraphScope by alibaba.
the class RemoteGraph method refresh.
@Override
public void refresh() throws Exception {
InstanceStatus serverStatuses = clientManager.getServerDataApiClient().getServerStatuses();
List<RemoteProxy> proxys = new ArrayList<>(serverStatuses.server2WorkerInfo.size());
Set<WorkerInfo> workerInfoSet = new TreeSet<>(serverStatuses.getWorkInfo(RoleType.EXECUTOR));
for (WorkerInfo v : workerInfoSet) {
if (serverStatuses.assignments.containsKey(v.id)) {
ServerAssignment serverAssignment = serverStatuses.readServerAssignment(v.id);
serverAssignment.getPartitions().forEach(p -> partitionDistri.put(p, v.id));
proxys.add(new RemoteProxy(v.endpoint.getIp(), v.endpoint.getPort(), 120L, schemaFetcher, this));
}
}
List<Endpoint> endpointList = workerInfoSet.stream().map(workerInfo -> workerInfo.endpoint).collect(toList());
LOG.info("proxys: {}", JSON.toJson(endpointList));
List<RemoteProxy> prevProxyList = this.proxys;
this.proxys = proxys;
try {
for (RemoteProxy remoteProxy : prevProxyList) {
remoteProxy.close();
}
} finally {
LOG.info("Close all previous remote proxy");
}
// TODO : dynamic configuration of different Graph Partitioner;
this.partitioner = new DefaultGraphPartitioner(schemaFetcher.getPartitionNum());
}
Aggregations