Copilot commented on code in PR #18344:
URL:
https://github.com/apache/dolphinscheduler/pull/18344#discussion_r3402354013
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/TaskGroupCoordinator.java:
##########
@@ -317,6 +317,16 @@ private void dealWithWaitingTaskGroupQueue() {
}
}
+ @Override
+ public boolean isTaskWaitingForTaskGroupSlot(final TaskInstance
taskInstance) {
+ if (!TaskGroupUtils.isUsingTaskGroup(taskInstance)) {
+ return false;
+ }
+ List<TaskGroupQueue> taskGroupQueues =
taskGroupQueueDao.queryByTaskInstanceId(taskInstance.getId());
+ return taskGroupQueues.stream()
+ .anyMatch(q -> q.getStatus() ==
TaskGroupQueueStatus.WAIT_QUEUE);
+ }
Review Comment:
`isTaskWaitingForTaskGroupSlot` can throw `NullPointerException` when
`taskInstance` is null (since `TaskGroupUtils.isUsingTaskGroup` dereferences
it) or when `taskInstance.getId()` is null (DB query + stream). This method is
used from pause/kill handling, so a defensive null/empty check would prevent
unexpected failures in edge cases (e.g., partially-initialized task executions).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]