Search in sources :

Example 16 with Task

use of com.baidu.hugegraph.structure.Task in project incubator-hugegraph-toolchain by apache.

the class JobApiTest method testRebuildEdgeLabel.

@Test
public void testRebuildEdgeLabel() {
    EdgeLabel created = schema().getEdgeLabel("created");
    long taskId = rebuildAPI.rebuild(created);
    Task task = taskAPI.get(taskId);
    Assert.assertNotNull(task);
    Assert.assertEquals(taskId, task.id());
    waitUntilTaskCompleted(taskId);
}
Also used : Task(com.baidu.hugegraph.structure.Task) EdgeLabel(com.baidu.hugegraph.structure.schema.EdgeLabel) Test(org.junit.Test)

Example 17 with Task

use of com.baidu.hugegraph.structure.Task in project incubator-hugegraph-toolchain by apache.

the class JobApiTest method testRebuildVertexLabel.

@Test
public void testRebuildVertexLabel() {
    VertexLabel person = schema().getVertexLabel("person");
    long taskId = rebuildAPI.rebuild(person);
    Task task = taskAPI.get(taskId);
    Assert.assertNotNull(task);
    Assert.assertEquals(taskId, task.id());
    waitUntilTaskCompleted(taskId);
}
Also used : Task(com.baidu.hugegraph.structure.Task) VertexLabel(com.baidu.hugegraph.structure.schema.VertexLabel) Test(org.junit.Test)

Example 18 with Task

use of com.baidu.hugegraph.structure.Task 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

Task (com.baidu.hugegraph.structure.Task)18 Test (org.junit.Test)12 IndexLabel (com.baidu.hugegraph.structure.schema.IndexLabel)7 HashSet (java.util.HashSet)4 HugeClient (com.baidu.hugegraph.driver.HugeClient)3 ArrayList (java.util.ArrayList)3 SchemaManager (com.baidu.hugegraph.driver.SchemaManager)2 ExecuteHistory (com.baidu.hugegraph.entity.query.ExecuteHistory)2 InternalException (com.baidu.hugegraph.exception.InternalException)2 ResultSet (com.baidu.hugegraph.structure.gremlin.ResultSet)2 EdgeLabel (com.baidu.hugegraph.structure.schema.EdgeLabel)2 GremlinRequest (com.baidu.hugegraph.api.gremlin.GremlinRequest)1 TaskAPI (com.baidu.hugegraph.api.task.TaskAPI)1 TasksWithPage (com.baidu.hugegraph.api.task.TasksWithPage)1 ExternalException (com.baidu.hugegraph.exception.ExternalException)1 AuthBackupRestoreManager (com.baidu.hugegraph.manager.AuthBackupRestoreManager)1 BackupManager (com.baidu.hugegraph.manager.BackupManager)1 DumpGraphManager (com.baidu.hugegraph.manager.DumpGraphManager)1 GraphsManager (com.baidu.hugegraph.manager.GraphsManager)1 GremlinManager (com.baidu.hugegraph.manager.GremlinManager)1