Skip to content

Commit

Permalink
Check if master node before schedule gremlin job (#1314)
Browse files Browse the repository at this point in the history
Change-Id: I9ef3e1f3f4d30ae8b252a53c148b0b0759eff472
  • Loading branch information
Linary authored Dec 28, 2020
1 parent 0f15c46 commit 717d93e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,12 @@ public void waitUntilAllTasksCompleted(long seconds)
this.taskScheduler.waitUntilAllTasksCompleted(seconds);
}

@Override
public void checkRequirement(String op) {
verifyStatusPermission();
this.taskScheduler.checkRequirement(op);
}

private void verifyTaskPermission(HugePermission actionPerm) {
verifyPermission(actionPerm, ResourceType.TASK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public HugeTask<V> schedule() {
E.checkArgumentNotNull(this.job, "Job callable can't be null");
E.checkArgument(this.job instanceof TaskCallable,
"Job must be instance of TaskCallable");

this.graph.taskScheduler().checkRequirement("schedule");

@SuppressWarnings("unchecked")
TaskCallable<V> job = (TaskCallable<V>) this.job;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ public void waitUntilAllTasksCompleted(long seconds)
taskSize, seconds));
}

@Override
public void checkRequirement(String op) {
this.checkOnMasterNode(op);
}

private <V> Iterator<HugeTask<V>> queryTask(String key, Object value,
long limit, String page) {
return this.queryTask(ImmutableMap.of(key, value), limit, page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ public <V> HugeTask<V> waitUntilTaskCompleted(Id id)

public void waitUntilAllTasksCompleted(long seconds)
throws TimeoutException;

public void checkRequirement(String op);
}

0 comments on commit 717d93e

Please sign in to comment.