Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-50648][CORE] Cleanup zombie tasks in non-running stages when the job is cancelled #49270
[SPARK-50648][CORE] Cleanup zombie tasks in non-running stages when the job is cancelled #49270
Changes from 3 commits
893fe64
a820cad
1bcd4b6
7fb4bc1
9a58f60
bc33ffb
4e0fd2f
c589fe8
8ebd0b1
85c7c02
d2822ed
a37c667
85a3577
d2dec02
5bad1fd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we check the
failedAttemptIds
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can Please see this
I'm not sure which way is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like @Ngone51's suggestion better - simply check for
stage.failedAttemptIds.nonEmpty || runningStages.contains(stage)
.I can see an argument being made for failed as well.
With this, the PR will boil down to this change and tests to stress this logic ofcourse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mridulm @Ngone51 do you think it is necessary
(waitingStages.contains(stage) && stage.failedAttemptIds.nonEmpty) || runningStages.contains(stage)
. Only consideringfailedAttemptIds
may result in repeated calls to the the stage already completed and failed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there could be a case where the stage exists in
failedStages
but not inwaitingStages
, e.g., in the case of fetch failures, map stage and reduce stage can be added intofailedStages
, but the related job could be canceled before they were resubmitted. So addingwaitingStages.contains(stage)
would miss the stages infailedStages
. And I don't think we would have repeated calls as we don't kill tasks for those failed stages.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the confirmation, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last one added is the resubmit stage (FetchFailed) and in waiting stages. We will kill it and one more SparkListenerStageCompleted event will be added ( see markStageAsFinished)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After changing to judging by
failedAttemptIds
, it won't cancel. Because all tasks finished already , inmarkStageAsFinished
will removefailedAttemptIds
if no error message.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yabola I'm curious about the difference here. With the current approach, doesn't the stage still has to be killed because of
failedAttemptIds.nonEmpty
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me explain the timeline of the last event in this UT:
handleTaskCompletion
, the result stagemarkStageAsFinished
and clean result stage'sfailedAttemptIds
cancelRunningIndependentStages
cancel map stage (it is in running stage) . Result stage is waiting , but don't havefailedAttemptIds
, so it won't be killed incancelRunningIndependentStages
(and also no running tasks in result stage)In this UT, it is really no need to kill the last result stage.
In addition, the result stage will always definitely kill all tasks when success, we don't have to worry about this. please see here
spark/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
Line 1960 in 939129e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, sounds good to me.