Search in sources :

Example 1 with TaskAPI

use of com.baidu.hugegraph.api.task.TaskAPI in project incubator-hugegraph-toolchain by apache.

the class BaseApiTest method init.

@BeforeClass
public static void init() {
    BaseClientTest.init();
    if (client == null) {
        initClient();
    }
    versionAPI = new VersionAPI(client);
    client.apiVersion(VersionUtil.Version.of(versionAPI.get().get("api")));
    graphsAPI = new GraphsAPI(client);
    propertyKeyAPI = new PropertyKeyAPI(client, GRAPH);
    vertexLabelAPI = new VertexLabelAPI(client, GRAPH);
    edgeLabelAPI = new EdgeLabelAPI(client, GRAPH);
    indexLabelAPI = new IndexLabelAPI(client, GRAPH);
    schemaAPI = new SchemaAPI(client, GRAPH);
    vertexAPI = new VertexAPI(client, GRAPH);
    edgeAPI = new EdgeAPI(client, GRAPH);
    variablesAPI = new VariablesAPI(client, GRAPH);
    taskAPI = new TaskAPI(client, GRAPH);
    rebuildAPI = new RebuildAPI(client, GRAPH);
}
Also used : RebuildAPI(com.baidu.hugegraph.api.job.RebuildAPI) EdgeAPI(com.baidu.hugegraph.api.graph.EdgeAPI) TaskAPI(com.baidu.hugegraph.api.task.TaskAPI) VertexLabelAPI(com.baidu.hugegraph.api.schema.VertexLabelAPI) VertexAPI(com.baidu.hugegraph.api.graph.VertexAPI) EdgeLabelAPI(com.baidu.hugegraph.api.schema.EdgeLabelAPI) VersionAPI(com.baidu.hugegraph.api.version.VersionAPI) SchemaAPI(com.baidu.hugegraph.api.schema.SchemaAPI) PropertyKeyAPI(com.baidu.hugegraph.api.schema.PropertyKeyAPI) VariablesAPI(com.baidu.hugegraph.api.variables.VariablesAPI) GraphsAPI(com.baidu.hugegraph.api.graphs.GraphsAPI) IndexLabelAPI(com.baidu.hugegraph.api.schema.IndexLabelAPI) BeforeClass(org.junit.BeforeClass)

Example 2 with TaskAPI

use of com.baidu.hugegraph.api.task.TaskAPI in project incubator-hugegraph-toolchain by apache.

the class TaskCache method asyncQueryTask.

private void asyncQueryTask() {
    for (Map.Entry<TaskAPI, Map<Long, Task>> query : this.taskTable.entrySet()) {
        TaskAPI api = query.getKey();
        Map<Long, Task> targets = query.getValue();
        if (targets == null || targets.isEmpty()) {
            this.taskTable.remove(api);
            continue;
        }
        List<Long> taskIds = new ArrayList<>(targets.keySet());
        List<Task> results = api.list(taskIds);
        for (Task task : results) {
            targets.put(task.id(), task);
        }
    }
}
Also used : TaskAPI(com.baidu.hugegraph.api.task.TaskAPI) Task(com.baidu.hugegraph.structure.Task) ArrayList(java.util.ArrayList) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

TaskAPI (com.baidu.hugegraph.api.task.TaskAPI)2 EdgeAPI (com.baidu.hugegraph.api.graph.EdgeAPI)1 VertexAPI (com.baidu.hugegraph.api.graph.VertexAPI)1 GraphsAPI (com.baidu.hugegraph.api.graphs.GraphsAPI)1 RebuildAPI (com.baidu.hugegraph.api.job.RebuildAPI)1 EdgeLabelAPI (com.baidu.hugegraph.api.schema.EdgeLabelAPI)1 IndexLabelAPI (com.baidu.hugegraph.api.schema.IndexLabelAPI)1 PropertyKeyAPI (com.baidu.hugegraph.api.schema.PropertyKeyAPI)1 SchemaAPI (com.baidu.hugegraph.api.schema.SchemaAPI)1 VertexLabelAPI (com.baidu.hugegraph.api.schema.VertexLabelAPI)1 VariablesAPI (com.baidu.hugegraph.api.variables.VariablesAPI)1 VersionAPI (com.baidu.hugegraph.api.version.VersionAPI)1 Task (com.baidu.hugegraph.structure.Task)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 BeforeClass (org.junit.BeforeClass)1