kfaraz commented on code in PR #16535:
URL: https://github.com/apache/druid/pull/16535#discussion_r1623796221


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -3183,35 +3181,34 @@ private void checkTaskDuration() throws 
ExecutionException, InterruptedException
           Integer groupId = entry.getKey();
           TaskGroup group = entry.getValue();
 
-          if (stopTasksEarly) {
+          final DateTime earliestTaskStart = 
computeEarliestTaskStartTime(group);
+          final Duration runDuration = 
Duration.millis(DateTimes.nowUtc().getMillis() - earliestTaskStart.getMillis());
+          if (stopTasksEarly || group.getHandoffEarly()) {
+            // If shutdownEarly has been set, stop tasks irrespective of 
stopTaskCount
             log.info(
-                "Stopping task group [%d] early. It has run for [%s]",
-                groupId,
-                ioConfig.getTaskDuration()
+                "Stopping taskGroup[%d] early after running for duration[%s].",
+                groupId, runDuration
             );
             futureGroupIds.add(groupId);
             futures.add(checkpointTaskGroup(group, true));
-          } else {
-            DateTime earliestTaskStart = computeEarliestTaskStartTime(group);
-
-            if 
(earliestTaskStart.plus(ioConfig.getTaskDuration()).isBeforeNow() || 
group.getHandoffEarly()) {
-              // if this task has run longer than the configured duration
-              // as long as the pending task groups are less than the 
configured stop task count.
-              // If shutdownEarly has been set, ignore stopTaskCount since 
this is a manual operator action.
-              if (pendingCompletionTaskGroups.values()
-                                             .stream()
-                                             
.mapToInt(CopyOnWriteArrayList::size)
-                                             .sum() + stoppedTasks.get()
-                  < ioConfig.getMaxAllowedStops() || group.getHandoffEarly()) {
-                log.info(
-                    "Task group [%d] has run for [%s]. Stopping.",
-                    groupId,
-                    ioConfig.getTaskDuration()
-                );
-                futureGroupIds.add(groupId);
-                futures.add(checkpointTaskGroup(group, true));
-                stoppedTasks.getAndIncrement();
-              }
+            if (group.getHandoffEarly()) {

Review Comment:
   Yes, I did do it to retain the older logic.
   
   I am not sure how the handoff early would be used with `stopTaskCount` and 
if a combo of the two would be a valid use case.
   
   However, if this needs to be fixed, I think it should be done in a separate 
PR and not in this one as this PR is concerned only with log cleanup.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to