georgew5656 commented on code in PR #14643:
URL: https://github.com/apache/druid/pull/14643#discussion_r1275008584


##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunner.java:
##########
@@ -134,46 +134,37 @@ public Optional<InputStream> streamTaskLog(String taskid, 
long offset)
   @Override
   public ListenableFuture<TaskStatus> run(Task task)
   {
-    return tasks.computeIfAbsent(
-        task.getId(), k -> new KubernetesWorkItem(task, exec.submit(() -> 
runTask(task)))
-    ).getResult();
+    return runOrJoinTask(task, true);
   }
 
-  protected ListenableFuture<TaskStatus> joinAsync(Task task)
+  protected ListenableFuture<TaskStatus> runOrJoinTask(Task task, boolean run)

Review Comment:
   yeah agree, we can just put the synchronized block in (revert parts of that 
previous pr i made to remove them) without changing any function names



##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunner.java:
##########
@@ -134,46 +134,37 @@ public Optional<InputStream> streamTaskLog(String taskid, 
long offset)
   @Override
   public ListenableFuture<TaskStatus> run(Task task)
   {
-    return tasks.computeIfAbsent(
-        task.getId(), k -> new KubernetesWorkItem(task, exec.submit(() -> 
runTask(task)))
-    ).getResult();
+    return runOrJoinTask(task, true);
   }
 
-  protected ListenableFuture<TaskStatus> joinAsync(Task task)
+  protected ListenableFuture<TaskStatus> runOrJoinTask(Task task, boolean run)

Review Comment:
   yeah agree, we can just put the synchronized block back in in (revert parts 
of that previous pr i made to remove them) without changing any function names



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