Search in sources :

Example 1 with EphemeralJob

use of com.baidu.hugegraph.job.EphemeralJob in project incubator-hugegraph by apache.

the class HugeTask method syncWait.

public void syncWait() {
    // This method is just called by tests
    HugeTask<?> task = null;
    try {
        task = this.scheduler().waitUntilTaskCompleted(this.id());
    } catch (Throwable e) {
        if (this.callable() instanceof EphemeralJob && e.getClass() == NotFoundException.class && e.getMessage().contains("Can't find task with id")) {
            /*
                 * The task with EphemeralJob won't saved in backends and
                 * will be removed from memory when completed
                 */
            return;
        }
        throw new HugeException("Failed to wait for task '%s' completed", e, this.id);
    }
    assert task != null;
    /*
         * This can be enabled for debug to expose schema-clear errors early,
         * but also lead to some negative tests failed,
         */
    boolean debugTest = false;
    if (debugTest && !task.success()) {
        throw new HugeException("Task '%s' is failed with error: %s", task.id(), task.result());
    }
}
Also used : NotFoundException(com.baidu.hugegraph.exception.NotFoundException) EphemeralJob(com.baidu.hugegraph.job.EphemeralJob) HugeException(com.baidu.hugegraph.HugeException)

Aggregations

HugeException (com.baidu.hugegraph.HugeException)1 NotFoundException (com.baidu.hugegraph.exception.NotFoundException)1 EphemeralJob (com.baidu.hugegraph.job.EphemeralJob)1