JoshRosen commented on code in PR #43926:
URL: https://github.com/apache/spark/pull/43926#discussion_r1402712326


##########
core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala:
##########
@@ -1264,14 +1280,24 @@ private[spark] class DAGScheduler(
     listenerBus.post(SparkListenerTaskGettingResult(taskInfo))
   }
 
-  private[scheduler] def handleJobSubmitted(jobId: Int,
+  private[scheduler] def handleJobSubmitted(
+      jobId: Int,
       finalRDD: RDD[_],
       func: (TaskContext, Iterator[_]) => _,
       partitions: Array[Int],
       callSite: CallSite,
       listener: JobListener,
       artifacts: JobArtifactSet,
       properties: Properties): Unit = {
+    // If this job belongs to a cancelled job group, skip running it
+    val jobGroupIdOpt = 
Option(properties).map(_.getProperty(SparkContext.SPARK_JOB_GROUP_ID))
+    if (jobGroupIdOpt.exists(cancelledJobGroups.contains(_))) {

Review Comment:
   +1, I agree with @anchovYu's assessment:
   
   - This `handleJobSubmitted` method and the `handleJobGroupCancelled` method 
both run in the single-threaded event thread.
   - Consider both potential interleavings:
     - If `handleJobGroupCancelled` runs first then the group will be marked as 
cancelled and `handleJobSubmitted` will skip the job.
     - If `handleJobSubmitted` runs first then `handleJobGroupCancelled` will 
see a running job and cancel it.



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