You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "nlippis (via GitHub)" <gi...@apache.org> on 2023/04/05 02:11:10 UTC
[GitHub] [druid] nlippis commented on a diff in pull request #14030: Fix race condition in KubernetesTaskRunner between shutdown and getKnownTasks
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org