Skip to content

Commit

Permalink
check custom meta data to avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrik Muhs committed Jan 17, 2020
1 parent 394f09c commit a8d2ade
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,16 @@ static Tuple<Set<String>, Set<String>> findTasksWithoutConfig(ClusterState state
Set<String> taskIds = new HashSet<>();
Set<String> executorNodes = new HashSet<>();

Predicate<PersistentTask<?>> taskMatcher = Strings.isAllOrWildcard(new String[] { transformId }) ? t -> true : t -> {
TransformTaskParams transformParams = (TransformTaskParams) t.getParams();
return Regex.simpleMatch(transformId, transformParams.getId());
};

for (PersistentTasksCustomMetaData.PersistentTask<?> pTask : tasks.findTasks(TransformField.TASK_NAME, taskMatcher)) {
executorNodes.add(pTask.getExecutorNode());
taskIds.add(pTask.getId());
if (tasks != null) {
Predicate<PersistentTask<?>> taskMatcher = Strings.isAllOrWildcard(new String[] { transformId }) ? t -> true : t -> {
TransformTaskParams transformParams = (TransformTaskParams) t.getParams();
return Regex.simpleMatch(transformId, transformParams.getId());
};

for (PersistentTasksCustomMetaData.PersistentTask<?> pTask : tasks.findTasks(TransformField.TASK_NAME, taskMatcher)) {
executorNodes.add(pTask.getExecutorNode());
taskIds.add(pTask.getId());
}
}

return new Tuple<>(taskIds, executorNodes);
Expand Down

0 comments on commit a8d2ade

Please sign in to comment.