use of com.baidu.hugegraph.api.job.GremlinAPI.GremlinRequest in project incubator-hugegraph by apache.
the class TaskCoreTest method testGremlinJob.
@Test
public void testGremlinJob() throws TimeoutException {
HugeGraph graph = graph();
TaskScheduler scheduler = graph.taskScheduler();
GremlinRequest request = new GremlinRequest();
request.gremlin("sleep(100); 3 + 5");
JobBuilder<Object> builder = JobBuilder.of(graph);
builder.name("test-job-gremlin").input(request.toJson()).job(new GremlinJob());
HugeTask<Object> task = builder.schedule();
Assert.assertEquals("test-job-gremlin", task.name());
Assert.assertEquals("gremlin", task.type());
Assert.assertFalse(task.completed());
Assert.assertNull(task.result());
task = scheduler.waitUntilTaskCompleted(task.id(), 10);
Assert.assertEquals("test-job-gremlin", task.name());
Assert.assertEquals("gremlin", task.type());
Assert.assertEquals(TaskStatus.SUCCESS, task.status());
Assert.assertEquals("8", task.result());
task = scheduler.task(task.id());
Assert.assertEquals("test-job-gremlin", task.name());
Assert.assertEquals("gremlin", task.type());
Assert.assertEquals(TaskStatus.SUCCESS, task.status());
Assert.assertEquals("8", task.result());
}
use of com.baidu.hugegraph.api.job.GremlinAPI.GremlinRequest in project incubator-hugegraph by apache.
the class TaskCoreTest method runGremlinJob.
private HugeTask<Object> runGremlinJob(String gremlin) {
HugeGraph graph = graph();
GremlinRequest request = new GremlinRequest();
request.gremlin(gremlin);
JobBuilder<Object> builder = JobBuilder.of(graph);
builder.name("test-gremlin-job").input(request.toJson()).job(new GremlinJob());
return builder.schedule();
}
Aggregations