Search in sources :

Example 1 with LoadParameter

use of com.baidu.hugegraph.entity.load.LoadParameter in project incubator-hugegraph-toolchain by apache.

the class LoadTaskService method buildLoadOptions.

private LoadOptions buildLoadOptions(GraphConnection connection, FileMapping fileMapping) {
    LoadOptions options = new LoadOptions();
    // Fill with input and server params
    options.file = fileMapping.getPath();
    // No need to specify a schema file
    options.host = connection.getHost();
    options.port = connection.getPort();
    options.graph = connection.getGraph();
    options.username = connection.getUsername();
    options.token = connection.getPassword();
    options.protocol = connection.getProtocol();
    options.trustStoreFile = connection.getTrustStoreFile();
    options.trustStoreToken = connection.getTrustStorePassword();
    // Fill with load parameters
    LoadParameter parameter = fileMapping.getLoadParameter();
    options.checkVertex = parameter.isCheckVertex();
    options.timeout = parameter.getInsertTimeout();
    options.maxReadErrors = parameter.getMaxParseErrors();
    options.maxParseErrors = parameter.getMaxParseErrors();
    options.maxInsertErrors = parameter.getMaxInsertErrors();
    options.retryTimes = parameter.getRetryTimes();
    options.retryInterval = parameter.getRetryInterval();
    // Optimized for hubble
    options.batchInsertThreads = 4;
    options.singleInsertThreads = 4;
    options.batchSize = 100;
    return options;
}
Also used : LoadParameter(com.baidu.hugegraph.entity.load.LoadParameter) LoadOptions(com.baidu.hugegraph.loader.executor.LoadOptions)

Example 2 with LoadParameter

use of com.baidu.hugegraph.entity.load.LoadParameter in project incubator-hugegraph-toolchain by apache.

the class FileMappingController method loadParameter.

/**
 * TODO: All file mapping share one load paramter now, should be separated
 *  in actually
 */
@PostMapping("load-parameter")
public void loadParameter(@RequestBody LoadParameter newEntity) {
    this.checkLoadParameter(newEntity);
    List<FileMapping> mappings = this.service.listAll();
    for (FileMapping mapping : mappings) {
        LoadParameter oldEntity = mapping.getLoadParameter();
        LoadParameter entity = this.mergeEntity(oldEntity, newEntity);
        mapping.setLoadParameter(entity);
        this.service.update(mapping);
    }
}
Also used : FileMapping(com.baidu.hugegraph.entity.load.FileMapping) LoadParameter(com.baidu.hugegraph.entity.load.LoadParameter) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

LoadParameter (com.baidu.hugegraph.entity.load.LoadParameter)2 FileMapping (com.baidu.hugegraph.entity.load.FileMapping)1 LoadOptions (com.baidu.hugegraph.loader.executor.LoadOptions)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1