maryannxue commented on code in PR #36238:
URL: https://github.com/apache/spark/pull/36238#discussion_r853536305


##########
core/src/main/scala/org/apache/spark/executor/Executor.scala:
##########
@@ -264,16 +290,26 @@ private[spark] class Executor(
     decommissioned = true
   }
 
+  private[executor] def createTaskRunner(context: ExecutorBackend,
+    taskDescription: TaskDescription) = new TaskRunner(context, 
taskDescription, plugins)
+
   def launchTask(context: ExecutorBackend, taskDescription: TaskDescription): 
Unit = {
-    val tr = new TaskRunner(context, taskDescription, plugins)
-    runningTasks.put(taskDescription.taskId, tr)
+    val taskId = taskDescription.taskId
+    val tr = createTaskRunner(context, taskDescription)
+    runningTasks.put(taskId, tr)
+    val killMark = killMarks.get(taskId)
+    if (killMark != null) {
+      tr.kill(killMark._1, killMark._2)
+      killMarks.remove(taskId)
+    }
     threadPool.execute(tr)

Review Comment:
   The argument of doing the kill inside the TaskRunner rather than here would 
be:
   1. not to duplicate the code for the kill routine;
   2. the kill routine can be executed in a separate thread.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to