Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,10 @@ private[spark] class TaskSchedulerImpl private[scheduler](
// 2. The task set manager has been created but no tasks has been scheduled. In this case,
// simply abort the stage.
tsm.runningTasksSet.foreach { tid =>
val execId = taskIdToExecutorId(tid)
backend.killTask(tid, execId, interruptThread, reason = "stage cancelled")
if (taskIdToExecutorId.contains(tid)) {
val execId = taskIdToExecutorId(tid)
backend.killTask(tid, execId, interruptThread)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you lost the value of "reason" here.
It's not a big deal but you could also write:

taskIdToExecutorId.get(tid).foreach(execId => backend.killTask(tid, execId, interruptThread, reason = "stage cancelled"))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I will update soon, thanks!

}
}
tsm.abort("Stage %s cancelled".format(stageId))
logInfo("Stage %d was cancelled".format(stageId))
Expand Down