nlippis commented on code in PR #14030:
URL: https://github.com/apache/druid/pull/14030#discussion_r1157936637


##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunner.java:
##########
@@ -425,7 +425,9 @@ public void registerListener(TaskRunnerListener listener, 
Executor executor)
   public Collection<TaskRunnerWorkItem> getRunningTasks()
   {
     List<TaskRunnerWorkItem> result = new ArrayList<>();
-    for (Pod existingTask : 
client.listPeonPods(Sets.newHashSet(PeonPhase.RUNNING))) {
+    for (Job existingTask : client.listAllPeonJobs().stream()
+        .filter(job -> job.getStatus() != null && job.getStatus().getActive() 
!= null && job.getStatus().getActive() > 0).collect(Collectors.toSet())

Review Comment:
   Instead of defining logic for whether the job is active, succeeded or failed 
in various places.  Can you create a class with a method for each state.  I.E
   
   ```
   JobStatus.isActive(Job job)
   JobStatus.isSucceeded(Job job)
   JobStatus.isFailed(Job job)
   ```



##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunner.java:
##########
@@ -338,7 +338,7 @@ public Map<String, Long> getTotalTaskSlotCount()
   public Collection<? extends TaskRunnerWorkItem> getKnownTasks()
   {
     List<TaskRunnerWorkItem> result = new ArrayList<>();
-    for (Pod existingTask : client.listPeonPods()) {
+    for (Job existingTask : client.listAllPeonJobs()) {

Review Comment:
   The `listPeonPods()` and `listPeonPods(Set<PeonPhase> phases)` methods will 
be unused if you make this change right?  If so please remove them.



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