Search in sources :

Example 1 with LoadStatus

use of com.baidu.hugegraph.entity.enums.LoadStatus in project incubator-hugegraph-toolchain by apache.

the class LoadTaskService method stop.

public LoadTask stop(int taskId) {
    LoadTask task = this.runningTaskContainer.get(taskId);
    if (task == null) {
        task = this.get(taskId);
    }
    LoadStatus status = task.getStatus();
    Ex.check(status == LoadStatus.RUNNING || status == LoadStatus.PAUSED, "Can only stop the RUNNING or PAUSED task");
    // Mark status as stopped
    task.setStatus(LoadStatus.STOPPED);
    if (status == LoadStatus.RUNNING) {
        task.stop();
    }
    task.lock();
    try {
        this.update(task);
        this.runningTaskContainer.remove(taskId);
    } finally {
        task.unlock();
    }
    return task;
}
Also used : LoadTask(com.baidu.hugegraph.entity.load.LoadTask) LoadStatus(com.baidu.hugegraph.entity.enums.LoadStatus)

Aggregations

LoadStatus (com.baidu.hugegraph.entity.enums.LoadStatus)1 LoadTask (com.baidu.hugegraph.entity.load.LoadTask)1